8 releases (stable)
Uses old Rust 2015
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 |
#2501 in Data structures
29 downloads per month
57KB
1K
SLoC
A bitmapped vector trie for Rust
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