#hash-map #back-end #size #different #key #performance #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

#126 in Algorithms

Download history 15506/week @ 2024-02-15 18642/week @ 2024-02-22 26332/week @ 2024-02-29 47916/week @ 2024-03-07 44560/week @ 2024-03-14 40520/week @ 2024-03-21 45185/week @ 2024-03-28 36506/week @ 2024-04-04 46334/week @ 2024-04-11 41014/week @ 2024-04-18 41586/week @ 2024-04-25 31577/week @ 2024-05-02 36696/week @ 2024-05-09 34454/week @ 2024-05-16 51153/week @ 2024-05-23 46479/week @ 2024-05-30

174,876 downloads per month
Used in 142 crates (9 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
~27K SLoC