From 7f99f964f74f7e77203bd505e69411af6dcae040 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Sat, 24 Feb 2024 14:50:52 +0100 Subject: docs: update benchmarks Signed-off-by: Henry Gressmann --- BENCHMARKS.md | 22 +++++++++++++--------- crates/benchmarks/benches/selfhosted.rs | 6 +++--- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/BENCHMARKS.md b/BENCHMARKS.md index 450b751..5090043 100644 --- a/BENCHMARKS.md +++ b/BENCHMARKS.md @@ -22,18 +22,22 @@ All runtimes are compiled with the following settings: ## Versions -- `tinywasm`: `0.4.0` -- `wasmi`: `0.31.0` -- `wasmer`: `4.2.0` +- `tinywasm`: `0.4.1` +- `wasmi`: `0.31.2` +- `wasmer`: `4.2.5` ## Results -| Benchmark | Native | TinyWasm | Wasmi | Wasmer (Single Pass) | -| ------------ | ------ | -------- | -------- | -------------------- | -| `fib` | 6ns | 44.76µs | 48.96µs | 52µs | -| `fib-rec` | 284ns | 25.565ms | 5.11ms | 0.50ms | -| `argon2id` | 0.52ms | 110.08ms | 44.408ms | 4.76ms | -| `selfhosted` | 45µs | 2.08ms | 4.25ms | 258.87ms | +| Benchmark | Native | TinyWasm\* | Wasmi | Wasmer (Single Pass) | +| ------------ | -------- | ---------- | --------- | -------------------- | +| `fib` | \*\* | ` 44.11µs` | `49.46µs` | ` 50.65µs` | +| `fib-rec` | `0.26ms` | ` 24.91ms` | ` 4.62ms` | ` 0.49ms` | +| `argon2id` | `0.53ms` | `109.38ms` | `45.85ms` | ` 4.82ms` | +| `selfhosted` | `0.05ms` | ` 2.07ms` | ` 4.26ms` | `260.32ms` | + +_\* converting WASM to TinyWasm bytecode is not included. 7.2.ms is the time it takes to convert `tinywasm.wasm` to TinyWasm bytecode._ + +_\*\* essentially instant as it gets computed at compile time._ ### Fib diff --git a/crates/benchmarks/benches/selfhosted.rs b/crates/benchmarks/benches/selfhosted.rs index 985577c..542343e 100644 --- a/crates/benchmarks/benches/selfhosted.rs +++ b/crates/benchmarks/benches/selfhosted.rs @@ -61,10 +61,10 @@ fn criterion_benchmark(c: &mut Criterion) { { 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("native", |b| b.iter(run_native)); group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(&twasm))); - // group.bench_function("wasmi", |b| b.iter(|| run_wasmi(TINYWASM))); - // group.bench_function("wasmer", |b| b.iter(|| run_wasmer(TINYWASM))); + group.bench_function("wasmi", |b| b.iter(|| run_wasmi(TINYWASM))); + group.bench_function("wasmer", |b| b.iter(|| run_wasmer(TINYWASM))); } } -- cgit v1.3.1