Skip to content

Commit 27e61be

Browse files
RuoqingHeroypat
andcommitted
aarch64: Remove redundant bench
The `criterion_benchmark_nop` function does literally nothing, there is no need to run these benchs. Re-organize the code to run `benches_bzimage` on x86 and x86_64 machines with `bzimage` feature enabled. Co-authored-by: Patrick Roy <roypat@amazon.co.uk> Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
1 parent c190963 commit 27e61be

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

benches/main.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,12 @@ mod aarch64;
2121
#[cfg(target_arch = "aarch64")]
2222
use aarch64::*;
2323

24-
pub fn criterion_benchmark_nop(_: &mut Criterion) {}
25-
2624
criterion_group! {
2725
name = benches;
2826
config = Criterion::default().sample_size(500);
2927
targets = criterion_benchmark
3028
}
3129

32-
#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), feature = "bzimage"))]
33-
// Explicit (arch, feature) tuple required as clippy complains about
34-
// `criterion_benchmark_bzimage` missing on aarch64.
35-
criterion_group! {
36-
name = benches_bzimage;
37-
// Only ~125 runs fit in 5 seconds. Either extend the duration, or reduce
38-
// the number of iterations.
39-
config = Criterion::default().sample_size(100);
40-
targets = criterion_benchmark_bzimage
41-
}
42-
43-
// NOP because the `criterion_main!` macro doesn't support cfg(feature)
44-
// macro expansions.
45-
#[cfg(any(target_arch = "aarch64", not(feature = "bzimage")))]
46-
criterion_group! {
47-
name = benches_bzimage;
48-
// Sample size must be >= 10.
49-
// https://github.com/bheisler/criterion.rs/blob/0.3.0/src/lib.rs#L757
50-
config = Criterion::default().sample_size(10);
51-
targets = criterion_benchmark_nop
52-
}
53-
5430
criterion_main! {
55-
benches,
56-
benches_bzimage
31+
benches
5732
}

benches/x86_64/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,11 @@ pub fn criterion_benchmark(c: &mut Criterion) {
120120
.unwrap();
121121
})
122122
});
123-
}
124123

125-
#[cfg(feature = "bzimage")]
126-
pub fn criterion_benchmark_bzimage(c: &mut Criterion) {
127-
let guest_mem = create_guest_memory();
124+
#[cfg(feature = "bzimage")]
128125
let bzimage = create_bzimage();
129126

127+
#[cfg(feature = "bzimage")]
130128
c.bench_function("load_bzimage", |b| {
131129
b.iter(|| {
132130
black_box(BzImage::load(

0 commit comments

Comments
 (0)