Skip to content

Commit 85b3e99

Browse files
roypatpb8o
authored andcommitted
bench: increase noise threshold
Empirical data has shown that the noise of our testing framework is quite high. Criterions default threshold of 1% yields a lot of false-positives (to the point where multiple tests fail spuriously even if there is no code change). Therefore, we increase it to 10%. This is still a significantly lower threshold than what the old baseline-based approach uses, where the deltas ranges from 16% to 400% (yes, four-hundred). Note that at 5%, significant rates of spurious failures were still observed. Signed-off-by: Patrick Roy <[email protected]>
1 parent 69cbb10 commit 85b3e99

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/snapshot/benches/version_map.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
124124

125125
criterion_group! {
126126
name = benches;
127-
// TODO: Fix the duration below to match the required time to collect enough samples.
128-
// A warning message is generated by criterion while the accuracy of the test will be lower.
129-
config = Criterion::default().measurement_time(std::time::Duration::from_secs(10));
127+
config = Criterion::default().sample_size(200).noise_threshold(0.05);
130128
targets = criterion_benchmark
131129
}
132130

src/vmm/benches/cpu_templates.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// * `CustomCpuTemplate` JSON serialization
77

88
use std::mem::size_of_val;
9-
use std::path::Path;
109

1110
use criterion::{criterion_group, criterion_main, Criterion};
1211
use vmm::cpu_config::templates::test_utils::{build_test_template, TEST_TEMPLATE_JSON};
@@ -45,7 +44,7 @@ pub fn cpu_template_benchmark(c: &mut Criterion) {
4544

4645
criterion_group! {
4746
name = cpu_template_benches;
48-
config = Criterion::default().sample_size(200);
47+
config = Criterion::default().sample_size(200).noise_threshold(0.05);
4948
targets = cpu_template_benchmark
5049
}
5150

0 commit comments

Comments
 (0)