diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2024-05-10 18:08:00 +0200 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2024-05-10 19:22:29 +0200 |
| commit | 868aa006b7f1eabffd4aec3a03555012148a7df1 (patch) | |
| tree | 164722ac37b3efb0f40bcf53925b7e79dc6493c1 /benchmarks/benches/selfhosted.rs | |
| parent | 2ac04cd653898786caca198726e6b9938185b76a (diff) | |
chore: slight perf improvements
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'benchmarks/benches/selfhosted.rs')
| -rw-r--r-- | benchmarks/benches/selfhosted.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/benchmarks/benches/selfhosted.rs b/benchmarks/benches/selfhosted.rs index 02d44ac..21ea79f 100644 --- a/benchmarks/benches/selfhosted.rs +++ b/benchmarks/benches/selfhosted.rs @@ -1,5 +1,4 @@ mod util; -use crate::util::twasm_to_module; use criterion::{criterion_group, criterion_main, Criterion}; fn run_native() { @@ -15,7 +14,7 @@ fn run_native() { fn run_tinywasm(twasm: &[u8]) { use tinywasm::*; - let module = twasm_to_module(twasm); + let module = Module::parse_bytes(twasm).expect("Module::parse_bytes"); let mut store = Store::default(); let mut imports = Imports::default(); imports.define("env", "printi32", Extern::typed_func(|_: FuncContext<'_>, _: i32| Ok(()))).expect("define"); @@ -54,15 +53,9 @@ fn run_wasmer(wasm: &[u8]) { const TINYWASM: &[u8] = include_bytes!("../../examples/rust/out/tinywasm.wasm"); fn criterion_benchmark(c: &mut Criterion) { { - let mut group = c.benchmark_group("selfhosted-parse"); - group.bench_function("tinywasm", |b| b.iter(|| util::parse_wasm(TINYWASM))); - } - - { - let twasm = util::wasm_to_twasm(TINYWASM); let mut group = c.benchmark_group("selfhosted"); group.bench_function("native", |b| b.iter(run_native)); - group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(&twasm))); + group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(TINYWASM))); group.bench_function("wasmi", |b| b.iter(|| run_wasmi(TINYWASM))); group.bench_function("wasmer", |b| b.iter(|| run_wasmer(TINYWASM))); } |
