Skip to content

Commit 5667609

Browse files
authored
Merge pull request #12 from linksplatform/issue-11-e4b0910fa505
Make benchmark link count configurable: 10 for PRs, 1000 for main branch
2 parents f600893 + 7c42f76 commit 5667609

File tree

17 files changed

+267
-202
lines changed

17 files changed

+267
-202
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ jobs:
6565
NEO4J_URI: bolt://localhost:7687
6666
NEO4J_USER: neo4j
6767
NEO4J_PASSWORD: password
68+
# Use 1000 links for main/master branch benchmarks, 10 for pull requests
69+
BENCHMARK_LINK_COUNT: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) && '1000' || '10' }}
6870
run: |
6971
set -o pipefail
7072
cargo bench --bench bench -- --output-format bencher | tee out.txt

rust/benches/bench.rs

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

3-
use {
4-
benchmarks::{
5-
create_links, delete_links, each_all, each_concrete, each_identity, each_incoming,
6-
each_outgoing, update_links,
7-
},
8-
criterion::{criterion_group, criterion_main},
3+
use benchmarks::{
4+
create_links, delete_links, each_all, each_concrete, each_identity, each_incoming,
5+
each_outgoing, update_links,
96
};
7+
use criterion::{criterion_group, criterion_main};
108

119
mod benchmarks;
1210

rust/benches/benchmarks/create.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
use {
2-
crate::tri,
3-
criterion::{measurement::WallTime, BenchmarkGroup, Criterion},
4-
doublets::{
5-
data::LinkType,
6-
mem::{Alloc, FileMapped},
7-
parts::LinkPart,
8-
split::{self, DataPart, IndexPart},
9-
unit, Doublets,
10-
},
11-
linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction, LINK_COUNT},
12-
std::{
13-
alloc::Global,
14-
time::{Duration, Instant},
15-
},
1+
use std::{
2+
alloc::Global,
3+
time::{Duration, Instant},
164
};
175

6+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
7+
use doublets::{
8+
data::LinkType,
9+
mem::{Alloc, FileMapped},
10+
parts::LinkPart,
11+
split::{self, DataPart, IndexPart},
12+
unit, Doublets,
13+
};
14+
use linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction, LINK_COUNT};
15+
16+
use crate::tri;
17+
1818
fn bench<T: LinkType, B: Benched + Doublets<T>>(
1919
group: &mut BenchmarkGroup<WallTime>,
2020
id: &str,
2121
mut benched: B,
2222
) {
2323
group.bench_function(id, |bencher| {
2424
bench!(|fork| as B {
25-
for _ in 0..LINK_COUNT {
25+
for _ in 0..*LINK_COUNT {
2626
let _ = elapsed! {fork.create_point()?};
2727
}
2828
})(bencher, &mut benched);

rust/benches/benchmarks/delete.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
use {
2-
crate::tri,
3-
criterion::{measurement::WallTime, BenchmarkGroup, Criterion},
4-
doublets::{
5-
mem::{Alloc, FileMapped},
6-
parts::LinkPart,
7-
split::{self, DataPart, IndexPart},
8-
unit, Doublets,
9-
},
10-
linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction, LINK_COUNT},
11-
std::{
12-
alloc::Global,
13-
time::{Duration, Instant},
14-
},
1+
use std::{
2+
alloc::Global,
3+
time::{Duration, Instant},
154
};
165

6+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
7+
use doublets::{
8+
mem::{Alloc, FileMapped},
9+
parts::LinkPart,
10+
split::{self, DataPart, IndexPart},
11+
unit, Doublets,
12+
};
13+
use linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction, LINK_COUNT};
14+
15+
use crate::tri;
16+
1717
fn bench<B: Benched + Doublets<usize>>(
1818
group: &mut BenchmarkGroup<WallTime>,
1919
id: &str,
@@ -23,11 +23,11 @@ fn bench<B: Benched + Doublets<usize>>(
2323
bench!(|fork| as B {
2424
use linksneo4j::BACKGROUND_LINKS;
2525
// Create additional links beyond background links to delete
26-
for _prepare in BACKGROUND_LINKS..BACKGROUND_LINKS + LINK_COUNT {
26+
for _prepare in BACKGROUND_LINKS..BACKGROUND_LINKS + *LINK_COUNT {
2727
let _ = fork.create_point();
2828
}
2929
// Delete the links we just created (in reverse order)
30-
for id in (BACKGROUND_LINKS + 1..=BACKGROUND_LINKS + LINK_COUNT).rev() {
30+
for id in (BACKGROUND_LINKS + 1..=BACKGROUND_LINKS + *LINK_COUNT).rev() {
3131
let _ = elapsed! {fork.delete(id)?};
3232
}
3333
})(bencher, &mut benched);

rust/benches/benchmarks/each/all.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
use {
2-
crate::tri,
3-
criterion::{measurement::WallTime, BenchmarkGroup, Criterion},
4-
doublets::{
5-
data::{Flow, LinkType},
6-
mem::{Alloc, FileMapped},
7-
parts::LinkPart,
8-
split::{self, DataPart, IndexPart},
9-
unit, Doublets,
10-
},
11-
linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction},
12-
std::{
13-
alloc::Global,
14-
time::{Duration, Instant},
15-
},
1+
use std::{
2+
alloc::Global,
3+
time::{Duration, Instant},
164
};
175

6+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
7+
use doublets::{
8+
data::{Flow, LinkType},
9+
mem::{Alloc, FileMapped},
10+
parts::LinkPart,
11+
split::{self, DataPart, IndexPart},
12+
unit, Doublets,
13+
};
14+
use linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction};
15+
16+
use crate::tri;
17+
1818
fn bench<T: LinkType, B: Benched + Doublets<T>>(
1919
group: &mut BenchmarkGroup<WallTime>,
2020
id: &str,

rust/benches/benchmarks/each/concrete.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
use {
2-
crate::tri,
3-
criterion::{measurement::WallTime, BenchmarkGroup, Criterion},
4-
doublets::{
5-
data::{Flow, LinksConstants},
6-
mem::{Alloc, FileMapped},
7-
parts::LinkPart,
8-
split::{self, DataPart, IndexPart},
9-
unit, Doublets,
10-
},
11-
linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction},
12-
std::{
13-
alloc::Global,
14-
time::{Duration, Instant},
15-
},
1+
use std::{
2+
alloc::Global,
3+
time::{Duration, Instant},
164
};
175

6+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
7+
use doublets::{
8+
data::{Flow, LinksConstants},
9+
mem::{Alloc, FileMapped},
10+
parts::LinkPart,
11+
split::{self, DataPart, IndexPart},
12+
unit, Doublets,
13+
};
14+
use linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction};
15+
16+
use crate::tri;
17+
1818
fn bench<B: Benched + Doublets<usize>>(
1919
group: &mut BenchmarkGroup<WallTime>,
2020
id: &str,

rust/benches/benchmarks/each/identity.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
use {
2-
crate::tri,
3-
criterion::{measurement::WallTime, BenchmarkGroup, Criterion},
4-
doublets::{
5-
data::{Flow, LinksConstants},
6-
mem::{Alloc, FileMapped},
7-
parts::LinkPart,
8-
split::{self, DataPart, IndexPart},
9-
unit, Doublets,
10-
},
11-
linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction},
12-
std::{
13-
alloc::Global,
14-
time::{Duration, Instant},
15-
},
1+
use std::{
2+
alloc::Global,
3+
time::{Duration, Instant},
164
};
175

6+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
7+
use doublets::{
8+
data::{Flow, LinksConstants},
9+
mem::{Alloc, FileMapped},
10+
parts::LinkPart,
11+
split::{self, DataPart, IndexPart},
12+
unit, Doublets,
13+
};
14+
use linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction};
15+
16+
use crate::tri;
17+
1818
fn bench<B: Benched + Doublets<usize>>(
1919
group: &mut BenchmarkGroup<WallTime>,
2020
id: &str,

rust/benches/benchmarks/each/incoming.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
use {
2-
crate::tri,
3-
criterion::{measurement::WallTime, BenchmarkGroup, Criterion},
4-
doublets::{
5-
data::{Flow, LinksConstants},
6-
mem::{Alloc, FileMapped},
7-
parts::LinkPart,
8-
split::{self, DataPart, IndexPart},
9-
unit, Doublets,
10-
},
11-
linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction},
12-
std::{
13-
alloc::Global,
14-
time::{Duration, Instant},
15-
},
1+
use std::{
2+
alloc::Global,
3+
time::{Duration, Instant},
164
};
175

6+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
7+
use doublets::{
8+
data::{Flow, LinksConstants},
9+
mem::{Alloc, FileMapped},
10+
parts::LinkPart,
11+
split::{self, DataPart, IndexPart},
12+
unit, Doublets,
13+
};
14+
use linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction};
15+
16+
use crate::tri;
17+
1818
fn bench<B: Benched + Doublets<usize>>(
1919
group: &mut BenchmarkGroup<WallTime>,
2020
id: &str,

rust/benches/benchmarks/each/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ mod identity;
44
mod incoming;
55
mod outgoing;
66

7-
pub use {
8-
all::each_all, concrete::each_concrete, identity::each_identity, incoming::each_incoming,
9-
outgoing::each_outgoing,
10-
};
7+
pub use all::each_all;
8+
pub use concrete::each_concrete;
9+
pub use identity::each_identity;
10+
pub use incoming::each_incoming;
11+
pub use outgoing::each_outgoing;

rust/benches/benchmarks/each/outgoing.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
use {
2-
crate::tri,
3-
criterion::{measurement::WallTime, BenchmarkGroup, Criterion},
4-
doublets::{
5-
data::{Flow, LinksConstants},
6-
mem::{Alloc, FileMapped},
7-
parts::LinkPart,
8-
split::{self, DataPart, IndexPart},
9-
unit, Doublets,
10-
},
11-
linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction},
12-
std::{
13-
alloc::Global,
14-
time::{Duration, Instant},
15-
},
1+
use std::{
2+
alloc::Global,
3+
time::{Duration, Instant},
164
};
175

6+
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion};
7+
use doublets::{
8+
data::{Flow, LinksConstants},
9+
mem::{Alloc, FileMapped},
10+
parts::LinkPart,
11+
split::{self, DataPart, IndexPart},
12+
unit, Doublets,
13+
};
14+
use linksneo4j::{bench, connect, Benched, Client, Exclusive, Fork, Transaction};
15+
16+
use crate::tri;
17+
1818
fn bench<B: Benched + Doublets<usize>>(
1919
group: &mut BenchmarkGroup<WallTime>,
2020
id: &str,

0 commit comments

Comments
 (0)