Skip to content

Commit ea7fe0d

Browse files
konardclaude
andcommitted
Split benchmark files into separate neo4j/ and doublets/ directories
Per user feedback, reorganize benchmarks to have clear separation between Neo4j and Doublets implementations. Each file now contains only one database's benchmarks for easy side-by-side comparison. New structure: - rust/benches/benchmarks/neo4j/ - All Neo4j benchmarks - rust/benches/benchmarks/doublets/ - All Doublets benchmarks Each directory has the same structure: - create.rs, update.rs, delete.rs - CRUD operations - each/all.rs, identity.rs, concrete.rs, outgoing.rs, incoming.rs - Query operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 31ff122 commit ea7fe0d

File tree

28 files changed

+1079
-785
lines changed

28 files changed

+1079
-785
lines changed

rust/benches/bench.rs

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#![feature(allocator_api)]
22

33
use benchmarks::{
4-
create_links, delete_links, each_all, each_concrete, each_identity, each_incoming,
5-
each_outgoing, update_links,
4+
// Neo4j benchmarks
5+
neo4j_create_links, neo4j_delete_links, neo4j_each_all, neo4j_each_concrete,
6+
neo4j_each_identity, neo4j_each_incoming, neo4j_each_outgoing, neo4j_update_links,
7+
// Doublets benchmarks
8+
doublets_create_links, doublets_delete_links, doublets_each_all, doublets_each_concrete,
9+
doublets_each_identity, doublets_each_incoming, doublets_each_outgoing, doublets_update_links,
610
};
711
use criterion::{criterion_group, criterion_main};
812

@@ -18,15 +22,30 @@ macro_rules! tri {
1822

1923
pub(crate) use tri;
2024

25+
// Neo4j benchmarks group
2126
criterion_group!(
22-
benches,
23-
create_links,
24-
delete_links,
25-
each_identity,
26-
each_concrete,
27-
each_outgoing,
28-
each_incoming,
29-
each_all,
30-
update_links
27+
neo4j_benches,
28+
neo4j_create_links,
29+
neo4j_delete_links,
30+
neo4j_each_identity,
31+
neo4j_each_concrete,
32+
neo4j_each_outgoing,
33+
neo4j_each_incoming,
34+
neo4j_each_all,
35+
neo4j_update_links
3136
);
32-
criterion_main!(benches);
37+
38+
// Doublets benchmarks group
39+
criterion_group!(
40+
doublets_benches,
41+
doublets_create_links,
42+
doublets_delete_links,
43+
doublets_each_identity,
44+
doublets_each_concrete,
45+
doublets_each_outgoing,
46+
doublets_each_incoming,
47+
doublets_each_all,
48+
doublets_update_links
49+
);
50+
51+
criterion_main!(neo4j_benches, doublets_benches);

rust/benches/benchmarks/create.rs

Lines changed: 0 additions & 126 deletions
This file was deleted.

rust/benches/benchmarks/delete.rs

Lines changed: 0 additions & 131 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//! # Doublets Create Links Benchmark
2+
//!
3+
//! This benchmark measures the performance of creating new links in Doublets.
4+
//!
5+
//! ## Implementation
6+
//!
7+
//! Doublets creates links by:
8+
//! - Allocating next available ID from internal counter
9+
//! - Writing (id, id, id) tuple directly to memory/file
10+
//! - Updating source and target indexes
11+
//! - Time complexity: O(log n) for index updates
12+
13+
use std::{
14+
alloc::Global,
15+
time::{Duration, Instant},
16+
};
17+
18+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
19+
use doublets::{
20+
mem::{Alloc, FileMapped},
21+
parts::LinkPart,
22+
split::{self, DataPart, IndexPart},
23+
unit, Doublets,
24+
};
25+
use linksneo4j::{bench, Benched, Fork, LINK_COUNT};
26+
27+
use crate::tri;
28+
29+
/// Runs the create benchmark on a Doublets backend.
30+
fn bench<B: Benched + Doublets<usize>>(
31+
group: &mut BenchmarkGroup<WallTime>,
32+
id: &str,
33+
mut benched: B,
34+
) {
35+
group.bench_function(id, |bencher| {
36+
bench!(|fork| as B {
37+
for _ in 0..*LINK_COUNT {
38+
let _ = elapsed! {fork.create_point()?};
39+
}
40+
})(bencher, &mut benched);
41+
});
42+
}
43+
44+
/// Creates benchmark for Doublets backends on link creation.
45+
pub fn create_links(c: &mut Criterion) {
46+
let mut group = c.benchmark_group("Create");
47+
48+
tri! {
49+
bench(
50+
&mut group,
51+
"Doublets_United_Volatile",
52+
unit::Store::<usize, Alloc<LinkPart<_>, Global>>::setup(()).unwrap()
53+
)
54+
}
55+
tri! {
56+
bench(
57+
&mut group,
58+
"Doublets_United_NonVolatile",
59+
unit::Store::<usize, FileMapped<LinkPart<_>>>::setup("united.links").unwrap()
60+
)
61+
}
62+
tri! {
63+
bench(
64+
&mut group,
65+
"Doublets_Split_Volatile",
66+
split::Store::<usize, Alloc<DataPart<_>, _>, Alloc<IndexPart<_>, _>>::setup(()).unwrap()
67+
)
68+
}
69+
tri! {
70+
bench(
71+
&mut group,
72+
"Doublets_Split_NonVolatile",
73+
split::Store::<usize, FileMapped<_>, FileMapped<_>>::setup(("split_index.links", "split_data.links")).unwrap()
74+
)
75+
}
76+
77+
group.finish();
78+
}

0 commit comments

Comments
 (0)