mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-18 09:21:03 +00:00
We should use bench_with_input so that a blackbox is used
This commit is contained in:
+4
-4
@@ -27,20 +27,20 @@ where
|
|||||||
let entry = entry.unwrap();
|
let entry = entry.unwrap();
|
||||||
let bytes = read(&entry.path()).unwrap();
|
let bytes = read(&entry.path()).unwrap();
|
||||||
group.throughput(Throughput::Bytes(bytes.len().try_into().unwrap()));
|
group.throughput(Throughput::Bytes(bytes.len().try_into().unwrap()));
|
||||||
group.bench_function(entry.file_name().to_str().unwrap(), |bench| {
|
group.bench_with_input(entry.file_name().to_str().unwrap(), &bytes, |bench, input| {
|
||||||
bench.iter(|| f(deserialize_buffer(&bytes).unwrap()))
|
bench.iter(|| f(deserialize_buffer(input).unwrap()))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn gas_metering(c: &mut Criterion) {
|
fn gas_metering(c: &mut Criterion) {
|
||||||
let mut group = c.benchmark_group("Gas Metering");
|
let mut group = c.benchmark_group("Gas Metering");
|
||||||
any_fixture(&mut group, |module| {
|
any_fixture(&mut group, |module| {
|
||||||
gas_metering::inject(module, &gas_metering::ConstantCostRules::default(), "env").unwrap();
|
gas_metering::inject(module, &gas_metering::ConstantCostRules::default(), "env").unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stack_height_limiter(c: &mut Criterion) {
|
fn stack_height_limiter(c: &mut Criterion) {
|
||||||
let mut group = c.benchmark_group("Stack Height Limiter");
|
let mut group = c.benchmark_group("Stack Height Limiter");
|
||||||
any_fixture(&mut group, |module| {
|
any_fixture(&mut group, |module| {
|
||||||
inject_stack_limiter(module, 128).unwrap();
|
inject_stack_limiter(module, 128).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user