Commit 10bad2b
committed
Reworked hashmap growing/rehashing behavior
- Now the hashmap grows only when actual live entries (i.e. not
tombstones) occupy at least 50% of the buckets after a successful
`EXT_HMAP_NEEDS_RESIZE` check (that checks if live entries + tombstones
exceed the 75% threshold). This should make the growing behaviour a little
bit more conservative, and it shows a ~50% increase in performance in
mixed usage scenarios (lots of inserts, deleted and lookups).
- Also, the re-hash only path is now done inline instead of allocating
new arrays of the same size. This mean that we have to do 2 passes
over the hashes array instead of 1, but saves memory and reduces
eventual heap fragmentation.
- Swapped old c-string hash function with FNV-1a Hash. This gives us a
slightly better distribution at no extra downsides.1 parent 6f4254d commit 10bad2b
1 file changed
Lines changed: 186 additions & 152 deletions
0 commit comments