Skip to content

Commit

Permalink
The bencher interface of the test crate in nightly changed. (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso authored Oct 6, 2022
1 parent 8ca225a commit 5d15a5f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
39 changes: 21 additions & 18 deletions benches/memory_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,23 @@ macro_rules! bench_gapped_randomized_access_with_1024_entries {
frame_size,
false,
)];
bencher.bench(|bencher| {
let config = Config::default();
let memory_mapping = $mem::new(memory_regions.clone(), &config).unwrap();
let mut prng = new_prng!();
bencher.iter(|| {
assert!(memory_mapping
.map(
AccessType::Load,
0x100000000 + (prng.gen::<u64>() % frame_count * (frame_size * 2)),
1
)
.is_ok());
});
});
bencher
.bench(|bencher| {
let config = Config::default();
let memory_mapping = $mem::new(memory_regions.clone(), &config).unwrap();
let mut prng = new_prng!();
bencher.iter(|| {
assert!(memory_mapping
.map(
AccessType::Load,
0x100000000 + (prng.gen::<u64>() % frame_count * (frame_size * 2)),
1
)
.is_ok());
});
Ok(())
})
.unwrap();
}
};
() => {
Expand Down Expand Up @@ -199,13 +202,13 @@ macro_rules! bench_randomized_mapping_with_n_entries {
}
bench_randomized_mapping_with_n_entries!(
1,
bench_randomized_mapping_with_001_entries_aligned,
bench_randomized_mapping_with_001_entries_unaligned
bench_randomized_mapping_with_0001_entries_aligned,
bench_randomized_mapping_with_0001_entries_unaligned
);
bench_randomized_mapping_with_n_entries!(
4,
bench_randomized_mapping_with_004_entries_aligned,
bench_randomized_mapping_with_004_entries_unaligned
bench_randomized_mapping_with_0004_entries_aligned,
bench_randomized_mapping_with_0004_entries_unaligned
);
bench_randomized_mapping_with_n_entries!(
16,
Expand Down
4 changes: 4 additions & 0 deletions benches/vm_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ fn bench_jit_vs_interpreter(
assert!(result.is_ok(), "{:?}", result);
assert_eq!(vm.get_total_instruction_count(), instruction_meter);
});
Ok(())
})
.unwrap()
.unwrap();
let jit_summary = bencher
.bench(|bencher| {
Expand All @@ -103,7 +105,9 @@ fn bench_jit_vs_interpreter(
assert!(result.is_ok(), "{:?}", result);
assert_eq!(vm.get_total_instruction_count(), instruction_meter);
});
Ok(())
})
.unwrap()
.unwrap();
println!(
"jit_vs_interpreter_ratio={}",
Expand Down

0 comments on commit 5d15a5f

Please sign in to comment.