Skip to content
Snippets Groups Projects
Commit b8b102d5 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Fix severe slowdown on certain strings in LuaJIT

Apply a patch from Yura Sokolov:

The default "fast" string hash function samples only a few positions in
a string, the remaining bytes don't affect the function's result. The
function performs well for short strings; however long strings can yield
extremely high collision rates.

An adaptive schema was implemented. Two hash functions are used
simultaneously. A bucket is picked based on the output of the fast hash
function. If an item is to be inserted in a collision chain longer than
a certain threshold, another bucket is picked based on the stronger hash
function. Since two hash functions are used simultaneously, insert
should consider two buckets. The second bucket is often NOT considered
thanks to the bloom filter. The filter is rebuilt during GC cycle.
parent cef07700
No related branches found
No related tags found
No related merge requests found
Subproject commit e6e25b42ecee28b9b801872d313fd36815386536
Subproject commit 614040402b05d37a3b7f2842fdecf7fb901d0651
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment