I think the choice of B = 1024 is far, far too large for an in-memory data structure. Such choices only make sense for disk applications.
The result of this is that indexset is ~28x slower than the stdlib BTreeMap for this simple benchmark:
use std::time::Instant;
fn main() {
let mut bs = std::collections::BTreeSet::new();
let start = Instant::now();
for i in (0..100_000_000).rev() {
bs.insert(i);
}
dbg!(start.elapsed());
std::hint::black_box(bs);
let mut bs = indexset::BTreeSet::new();
let start = Instant::now();
for i in (0..100_000_000).rev() {
bs.insert(i);
}
dbg!(start.elapsed());
std::hint::black_box(bs);
}
The standard library finishes in 2 seconds on my machine, indexset takes 56 seconds.
I think the choice of B = 1024 is far, far too large for an in-memory data structure. Such choices only make sense for disk applications.
The result of this is that
indexsetis ~28x slower than the stdlibBTreeMapfor this simple benchmark:The standard library finishes in 2 seconds on my machine,
indexsettakes 56 seconds.