mirror of
https://codeberg.org/ziglang/zig
synced 2026-11-18 07:05:05 +00:00
stage1 HashMap: store hash & do robin hood hashing
This adds these two fields to a HashMap Entry:
uint32_t hash
uint32_t distance_from_start_index
Compared to master branch, standard library tests compiled 8.4% faster
and took negligible (0.001%) more memory to complete. The amount of
memory used is still down from before 8b82c40104 which moved indexes
to be stored separately from entries.
So, it turns out, keeping robin hood hashing plus separating indexes
did result in a performance improvement. What happened previously is
that the gains from separating indexes balanced out the losses from
removing robin hood hashing, resulting in a wash.
This also serves as an inspiration for adding a benchmark to
std.AutoHashMap and improving the implementation.
This commit is contained in:
parent
70cc1751ca
commit
df2c27eb48
2 changed files with 102 additions and 30 deletions
129
src/hash_map.hpp
129
src/hash_map.hpp
Loading…
Add table
Add a link
Reference in a new issue