From f8651619e576ac97209b72660144568b54eb965c Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Mon, 29 Jan 2024 20:39:31 +0100 Subject: feat: pre-processed wasm Signed-off-by: Henry Gressmann --- benches/fibonacci.rs | 6 +++--- benches/selfhosted.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'benches') diff --git a/benches/fibonacci.rs b/benches/fibonacci.rs index 5d8a0bd..7c77ebf 100644 --- a/benches/fibonacci.rs +++ b/benches/fibonacci.rs @@ -9,7 +9,7 @@ fn run_tinywasm(module: TinyWasmModule, iterations: i32) { let mut store = Store::default(); let imports = Imports::default(); let instance = ModuleInstance::instantiate(&mut store, module, Some(imports)).expect("instantiate"); - let hello = instance.exported_func::(&mut store, "fibonacci").expect("exported_func"); + let hello = instance.exported_func::(&store, "fibonacci").expect("exported_func"); hello.call(&mut store, iterations).expect("call"); } @@ -29,8 +29,8 @@ fn criterion_benchmark(c: &mut Criterion) { let module = tinywasm_module(FIBONACCI); let mut group = c.benchmark_group("fibonacci"); - group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(module.clone(), black_box(50)))); - group.bench_function("wasmi", |b| b.iter(|| run_wasmi(black_box(50)))); + group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(module.clone(), black_box(60)))); + group.bench_function("wasmi", |b| b.iter(|| run_wasmi(black_box(60)))); } criterion_group!( diff --git a/benches/selfhosted.rs b/benches/selfhosted.rs index f78d958..b9df1af 100644 --- a/benches/selfhosted.rs +++ b/benches/selfhosted.rs @@ -10,7 +10,7 @@ fn run_tinywasm(module: TinyWasmModule) { let mut imports = Imports::default(); imports.define("env", "printi32", Extern::typed_func(|_: FuncContext<'_>, _: i32| Ok(()))).expect("define"); let instance = ModuleInstance::instantiate(&mut store, module, Some(imports)).expect("instantiate"); - let hello = instance.exported_func::<(), ()>(&mut store, "hello").expect("exported_func"); + let hello = instance.exported_func::<(), ()>(&store, "hello").expect("exported_func"); hello.call(&mut store, ()).expect("call"); } @@ -32,7 +32,7 @@ fn criterion_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("selfhosted"); group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(module.clone()))); - group.bench_function("wasmi", |b| b.iter(|| run_wasmi())); + group.bench_function("wasmi", |b| b.iter(run_wasmi)); } criterion_group!( -- cgit v1.3.1