Crates.io | xorfilter-rs |
lib.rs | xorfilter-rs |
version | 0.5.1 |
source | src |
created_at | 2020-03-18 16:38:51.568976 |
updated_at | 2021-09-08 08:58:44.251788 |
description | Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters |
homepage | https://github.com/bnclabs/xorfilter |
repository | https://github.com/bnclabs/xorfilter |
max_upload_size | |
id | 220198 |
size | 125,634 |
Implementation of Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters in rust-lang, Journal of Experimental Algorithmics (to appear).
This package is a port from its golang implementation.
Add the following under project's Cargo.toml
:
[dependencies]
xorfilter-rs = "0.2.0"
or
[dependencies]
xorfilter-rs = { git = "https://github.com/bnclabs/xorfilter" }
use xorfilter::Xor8;
let mut keys: Vec<u64> = vec![];
for _ in 0..num_keys {
keys.push(rng.gen());
}
let mut filter = Xor8::new(); // new filter.
filter.populate_keys(&keys); // populate keys.
filter.build(); // build bitmap.
for key in 0..lookup {
// there can be false positives, but no false negatives.
filter.contains_key(key);
}
Following are the results for a set of 10-million u64
keys:
build 10M keys | membership | FPP | Bits/Entry | |
---|---|---|---|---|
Xor8-C | 1.206 secs | NA | 0.389 % | 9.84 bits |
Xor8-rust | 1.809 secs | 61.716 ns | 0.392 % | 9.84 bits |
Fuse8-C | 0.508 secs | NA | 0.390 % | 9.02 bits |
Fuse8-rust | 0.577 secs | 42.657 ns | 0.392 % | 9.02 bits |
Fuse16-C | 0.515 secs | NA | 0.001 % | 18.04 bits |
Fuse16-rust | 0.621 secs | 54.657 ns | 0.001 % | 18.03 bits |
Seconds
, for 10 million entries.Nanosec
, for single lookup in a set of 10 million entries.make build
to confirm all versions of build is passing with
0 warnings and 0 errors.check.sh
with 0 warnings, 0 errors and all test-cases passing.perf.sh
with 0 warnings, 0 errors and all test-cases passing.cargo spellcheck
to remove common spelling mistakes.