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.rs9
1 files changed, 8 insertions, 1 deletions
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)));