Crate halfbrown

Source
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
IntoIter
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
OccupiedEntry
A view into an occupied entry in a HashMap. It is part of the Entry enum.
RawEntryBuilder
A builder for computing where in a [HashMap] a key-value pair would be stored.
RawEntryBuilderMut
A builder for computing where in a [HashMap] a key-value pair would be stored.
RawOccupiedEntryMut
A view into an occupied entry in a HashMap. It is part of the RawEntryMut enum.
RawVacantEntryMut
A view into a vacant entry in a HashMap. It is part of the RawEntryMut enum.
SizedHashMap
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
VacantEntry
A view into a vacant entry in a HashMap. It is part of the Entry enum.
Values
Iterator over the values
ValuesMut
Mutable iterator over the values

Enums§

Entry
A view into a single entry in a map, which may either be vacant or occupied.
RawEntryMut
A view into a single entry in a map, which may either be vacant or occupied.

Type Aliases§

DefaultHashBuilder
Default hasher for HashMap and HashSet.
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