summaryrefslogtreecommitdiff
path: root/benchmarks/benches/selfhosted.rs
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/benches/selfhosted.rs')
-rw-r--r--benchmarks/benches/selfhosted.rs11
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)));
}