Welcome! Log In Create A New Profile

Advanced

Use primes for hashtable size

Andrew Borodin
May 30, 2017 06:30AM
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.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Use primes for hashtable size Attachments

Andrew Borodin 740 May 30, 2017 06:30AM

Re: Use primes for hashtable size

Maxim Dounin 492 May 30, 2017 09:04AM

Re: Use primes for hashtable size

Andrew Borodin 485 June 01, 2017 07:56AM

Re: Use primes for hashtable size

Maxim Dounin 452 June 01, 2017 01:40PM

Re: Use primes for hashtable size

Andrew Borodin 430 June 01, 2017 01:58PM

Re: Use primes for hashtable size

splitice 551 June 01, 2017 08:58PM

Re: Use primes for hashtable size

Maxim Dounin 394 June 02, 2017 07:48AM

Re: Use primes for hashtable size

splitice 561 June 02, 2017 07:52AM

Re: Use primes for hashtable size

Andrew Borodin 463 June 03, 2017 02:02AM

Re: Use primes for hashtable size

Andrew Borodin 471 June 04, 2017 02:24PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 312
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready