]> git.puffer.fish Git - matthieu/frr.git/commit
hash: dynamically grow hash table
authorStephen Hemminger <shemminger@vyatta.com>
Fri, 11 Jan 2013 18:25:26 +0000 (18:25 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sun, 24 Feb 2013 19:48:16 +0000 (20:48 +0100)
commit97c84db00c01b808337bedf69f696a1517e3d8c0
tree1af03fc32c0fc938c148ebdf3ad1eb812e254efc
parent90645f5598ca8b25cd2692f2ac0d2778a3fd2755
hash: dynamically grow hash table

Dynamically grow the hash table index if the chains get too long.
If expansion doesn't help keep chain length short, then stop expanding,
to avoid bad behavior if there is a poor hash function.
Not a new idea, based on concepts in uthash.

Depends on my previous patch to restrict hash to power of 2.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
[profiling results: sum of cycles spent in hash_get/jhash with RIPE RIS
 test data (single simple BGP peer) improved to 69% of previously spent]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/hash.c
lib/hash.h