Skip to content

Commit

Permalink
Implement open addressing algorithm for RubyHash
Browse files Browse the repository at this point in the history
to improve the performance by leverage better
cache locality.

Switching from closed addressing hash algorithm (linked list)
to open addressing hashing because of a better cache locality
on modern CPU architectures.
Furthermore we removed almost all RubyHashEntry objects
for smaller memory allocation.
This is already implemented in MRI since 2.4, see
https://bugs.ruby-lang.org/issues/12142

Small hashes (less than 8 entries) are now
implemented via a linear search which reduces memory
allocation in this case and has almost no performance
implication. For a fast bucket skip we maintain
in this case a hashes array to cache the hash values.

Implements jruby#4708 & jruby#2989
  • Loading branch information
ChrisBr committed Jul 23, 2018
1 parent a2bc9a3 commit 651d78f
Show file tree
Hide file tree
Showing 2 changed files with 626 additions and 307 deletions.
Loading

0 comments on commit 651d78f

Please sign in to comment.