#hash-map #back-end #performance #size #key #hashbrown #space

halfbrown

Multi backend HashMap for higher performance on different key space sizes

25 releases

0.2.5 Mar 5, 2024
0.2.4 Jun 26, 2023
0.2.2 May 24, 2023
0.1.18 Dec 1, 2022
0.1.6 Jul 29, 2019

#161 in Algorithms

Download history 58128/week @ 2024-07-20 57949/week @ 2024-07-27 30766/week @ 2024-08-03 24372/week @ 2024-08-10 33522/week @ 2024-08-17 30965/week @ 2024-08-24 32937/week @ 2024-08-31 35933/week @ 2024-09-07 30783/week @ 2024-09-14 28916/week @ 2024-09-21 37099/week @ 2024-09-28 35240/week @ 2024-10-05 37107/week @ 2024-10-12 41773/week @ 2024-10-19 37698/week @ 2024-10-26 35185/week @ 2024-11-02

158,014 downloads per month
Used in 194 crates (8 directly)

Apache-2.0/MIT

125KB
2.5K SLoC

Halfbrown HashMap   Build Status Windows Build Status Latest Version

Hashmap implementation that dynamically switches from a vector based backend to a hashbrown based backend as the number of keys grows


Note: The heavy lifting in this is done in hashbrown, and the docs and API are copied from them.

Halfbrown, is a hashmap implementation that uses two backends to optimize for different cernairos:

VecMap

For less then 32 key value pairs it uses a dumb vector based map implementation. This trades the need to iterator through the vector for not having to hash strings on lookup or inserts.

Hashbrown

For more then 32 elements it upgrades the map to aq hashbrown base map to account for longer itteration times.

License

halfbrown itself is licensed under either of

at your option.

Code / docs copied from hashbrown are obviously licensed under their License.

Dependencies

~2MB
~28K SLoC