Skip to content

B is far too large #39

@orlp

Description

@orlp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions