Hi, nginxers!

We often use hashtable sizes equal to the power of 2. This can be
damaging for a hashtable. I haven't found any mitigation for this in
nginx code. So I made my own. If this issue is addressed somewhere
just ignore my message. Or I'd be happy if someone will point me it.

For the explanation of problem see
https://stackoverflow.com/questions/3980117/hash-table-why-size-should-be-prime

Code is checked for correctness of ngx_hash_min_prime(), I haven't
done any regression testing, sorry.

Also beware that I've changed state of paremeter hinit. I'm not sure
this is acceptable.

Thank you for your attention.

Best regards, Andrey Borodin, Octonica.

Attachment: primes_for_hash.patch
Description: Binary data

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to