Skip to content

Commit 1ec8df2

Browse files
goffrieConvex, Inc.
authored andcommitted
Add a benchmark for interval_map (#41321)
GitOrigin-RevId: b0a619e16d851a2d4c3e36f19ba58363a724b9e0
1 parent 6f34a98 commit 1ec8df2

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/interval_map/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ slab = { workspace = true }
1212
[dev-dependencies]
1313
cmd_util = { workspace = true }
1414
common = { workspace = true, features = ["testing"] }
15+
divan = { workspace = true }
1516
proptest = { workspace = true }
1617
proptest-derive = { workspace = true }
18+
tikv-jemallocator = { workspace = true }
19+
20+
[[bench]]
21+
name = "bench"
22+
harness = false
1723

1824
[lints]
1925
workspace = true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use common::interval::Interval;
2+
use interval_map::IntervalMap;
3+
use tikv_jemallocator::Jemalloc;
4+
5+
#[global_allocator]
6+
static ALLOC: Jemalloc = Jemalloc;
7+
8+
fn main() {
9+
divan::main();
10+
}
11+
12+
#[divan::bench(args = [10, 100, 1000, 10000, 100000])]
13+
fn equal_keys(n: usize) -> IntervalMap {
14+
let mut map = IntervalMap::new();
15+
map.insert(
16+
1,
17+
std::iter::repeat_n(Interval::prefix(vec![1; 64].into()), n),
18+
)
19+
.unwrap();
20+
map
21+
}

0 commit comments

Comments
 (0)