Expand description
Halfbrown is a hashmap implementation that provides high performance for both small and large maps by dynamically switching between different backend.
The basic idea is that hash maps are expensive to insert and lookup for small numbers of entries but effective for larger numbers.
So for smaller maps, we picked 32 entries as a rule of thumb, we simply store data in a list of tuples. Looking those up and iterating over them is still faster then hasing strings on every lookup.
Once we pass the 32 entires we transition the
backend to a HashMap
.
Note: Most of the documentation is taken from rusts hashmap.rs and should be considered under their copyright.
Macros§
- hashmap
- Create a
HashMap
from a list of key-value pairs
Structs§
- Drain
- Drains the map
- Into
Iter - Into iterator for a Halfbrown map
- Iter
- Iterator over the key value pairs of a Halfbrown map
- IterMut
- Mutable iterator over the key value pairs
- Keys
- Iterator over the keys
- Occupied
Entry - A view into an occupied entry in a
HashMap
. It is part of theEntry
enum. - RawEntry
Builder - A builder for computing where in a [
HashMap
] a key-value pair would be stored. - RawEntry
Builder Mut - A builder for computing where in a [
HashMap
] a key-value pair would be stored. - RawOccupied
Entry Mut - A view into an occupied entry in a
HashMap
. It is part of theRawEntryMut
enum. - RawVacant
Entry Mut - A view into a vacant entry in a
HashMap
. It is part of theRawEntryMut
enum. - Sized
Hash Map - Maximum nymber of elements before the representaiton is swapped from
Vec to
HashMap
SizedHashMap
implementation that alternates between a vector and a hashmap to improve performance for low key counts. With a configurable upper vector limit - Vacant
Entry - A view into a vacant entry in a
HashMap
. It is part of theEntry
enum. - Values
- Iterator over the values
- Values
Mut - Mutable iterator over the values
Enums§
- Entry
- A view into a single entry in a map, which may either be vacant or occupied.
- RawEntry
Mut - A view into a single entry in a map, which may either be vacant or occupied.
Type Aliases§
- Default
Hash Builder - Default hasher for
HashMap
andHashSet
. - HashMap
SizedHashMap
implementation that alternates between a vector and a hashmap to improve performance for low key counts. With a standard upper vector limit of 32