#btree-map #b-tree #collection #experiment #memory #insert #allocate

btree_experiment

Crate implements a BTreeMap similar to std::collections::BTreeMap

90 releases

new 0.1.93 May 1, 2024
0.1.91 Apr 29, 2024
0.1.39 Mar 31, 2024

#92 in Memory management

Download history 810/week @ 2024-03-19 2116/week @ 2024-03-26 2308/week @ 2024-04-02 1201/week @ 2024-04-09 1716/week @ 2024-04-16 825/week @ 2024-04-23

6,643 downloads per month
Used in 2 crates (via rustdb)

MIT/Apache

170KB
5K SLoC

This crate implements a BTreeMap similar to std::collections::BTreeMap.

The standard BtreeMap can use up to twice as much memory as required, this BTreeMap only allocates what is needed ( or a little more to avoid allocating too often ), so memory use can be up to 50% less.

Example

    use btree_experiment::BTreeMap;
    let mut mymap = BTreeMap::new();
    mymap.insert("England", "London");
    mymap.insert("France", "Paris");
    println!("The capital of France is {}", mymap["France"]);

Features

This crate supports the following cargo features:

  • serde : enables serialisation of BTreeMap via serde crate.
  • unsafe-optim : uses unsafe code for extra optimisation.

Dependencies

~240KB