Module thincollections::thin_map
source · Expand description
ThinMap
: a fast map with lower memory usage for small key values.
Unlike std::collections::HashMap
, ThinMap
is optimized for small key values.
It’s generally 2-5x faster (see the benchmarks).
It uses less memory because it doesn’t store the hash value (64bit x load factor per entry) for every entry in the map. It’s also faster for several reasons:
- It uses less memory, and accessing memory is expensive.
- It uses an adaptive, non-linear, cache line aware collision resolution, which allows it to use a simpler hashing algorithm.
- Unlike
std::collections::HashMap
, inserts and removes do not cause element movement.