At least 5x faster alternative of HashMap
,
for very small maps. It is also faster than
FxHashMap,
ArrayMap. The smaller the map, the higher the
performance. When the map is larger than 50, it is better to use standard
HashMap
.
WELCOME: Not all functions that a user expects to have in a map are implemented. I will appreciate if you contribute by implementing these missing functions.
Here is how you use it:
rust
use micromap::Map;
let mut m : Map<u64, &str, 10> = Map::new();
m.insert(1, "foo");
m.insert(2, "bar");
assert_eq!(2, m.len());
Pay attention, here the map is created with an extra generic argument 10
. This is
the total size of the map, which is allocated on stack when ::new()
is called.
Unlike HashMap
, the Map
doesn't use heap at all.
Read the API documentation. Important to notice
that signatures of some functions are different from HashMap
, for example remove()
and
insert()
expect arguments to be passes by-value instead of by-reference.
First, install Rust and then:
bash
$ cargo test -vv
If everything goes well, fork repository, make changes, send us a pull request.
We will review your changes and apply them to the master
branch shortly,
provided they don't violate our quality standards. To avoid frustration,
before sending us your pull request please run cargo test
again. Also,
run cargo fmt
and cargo clippy
.