#trie #vector #sparse

nightly bitmaptrie

Bitmapped vector trie (mutable, not persistent). Word-size path-cached indexing into essentially a sparse vector. Requires rust-nightly.

8 releases (stable)

2.0.0 Jun 6, 2017
1.3.1 Mar 8, 2016
1.1.2 Feb 25, 2016
1.0.1 Jan 18, 2016
0.9.0 Dec 24, 2015

#232 in Data structures

Download history 45/week @ 2019-07-10 20/week @ 2019-07-17 9/week @ 2019-08-07 32/week @ 2019-08-21 23/week @ 2019-08-28 47/week @ 2019-09-04 16/week @ 2019-09-11 158/week @ 2019-09-18 26/week @ 2019-09-25 14/week @ 2019-10-02 37/week @ 2019-10-16

74 downloads per month

MIT/Apache

57KB
1K SLoC

A bitmapped vector trie for Rust

Build Status Latest Version

Documentation

Requires Rust-nightly due to use of low-level unstable APIs.

This is a non-persistent bitmapped vector trie with word-size indexing: thus on a 32-bit system the indexing is 32 bits; on 64-bit it is 64 bits.

It essentially behaves as an unbounded (except by the word-size index) sparse vector.

Performance is good for spatially-close accesses but deteriorates for random spatially-sparse accesses. Performance improves significantly if compiled with popcnt and lzcnt instructions. See wiki for more.

The last access path is cached to accelerate the next nearby access.

Multi-path-cache methods are available for accelerating read-only accesses at multiple positions but the current design causes write performance to degrade.

Usage

extern crate bitmaptrie;
use bitmaptrie::Trie;

fn main() {
    let mut trie: Trie<String> = Trie::new();

    trie.set(123usize, "testing 123".to_owned());

    if let Some(value) = trie.get_mut(123) {
        *value = "test pass".to_owned();
    }
}

Author

Peter Liniker

License

Dual MIT/Apache 2.0

No runtime deps