summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/Cargo.toml6
-rw-r--r--benchmarks/benches/selfhosted.rs9
2 files changed, 11 insertions, 4 deletions
diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml
index f2cfe69..e137a92 100644
--- a/benchmarks/Cargo.toml
+++ b/benchmarks/Cargo.toml
@@ -5,10 +5,10 @@ edition.workspace=true
[dependencies]
criterion={version="0.5", features=["html_reports"]}
-tinywasm={path="../crates/tinywasm", features=["unsafe"]}
-wat={version="1.206"}
+tinywasm={path="../crates/tinywasm"}
+wat={version="1"}
wasmi={version="0.31", features=["std"]}
-wasmer={version="4.2", features=["cranelift", "singlepass"]}
+wasmer={version="4.3", features=["cranelift", "singlepass"]}
argon2={version="0.5"}
[[bench]]
diff --git a/benchmarks/benches/selfhosted.rs b/benchmarks/benches/selfhosted.rs
index 21ea79f..4241eea 100644
--- a/benchmarks/benches/selfhosted.rs
+++ b/benchmarks/benches/selfhosted.rs
@@ -1,5 +1,5 @@
mod util;
-use criterion::{criterion_group, criterion_main, Criterion};
+use criterion::{black_box, criterion_group, criterion_main, Criterion};
fn run_native() {
use tinywasm::*;
@@ -53,6 +53,13 @@ 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(|| tinywasm::Module::parse_bytes(black_box(TINYWASM)).expect("parse"))
+ });
+ }
+
+ {
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(TINYWASM)));