From 7c3fd68f703d944b05dcea08f3a46c59b41503f4 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Thu, 30 May 2024 01:16:56 +0200 Subject: chore: cleanup Signed-off-by: Henry Gressmann --- benchmarks/benches/argon2id.rs | 2 +- benchmarks/benches/fibonacci.rs | 6 ++++-- benchmarks/benches/selfhosted.rs | 18 +++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'benchmarks/benches') diff --git a/benchmarks/benches/argon2id.rs b/benchmarks/benches/argon2id.rs index e458983..76e1eee 100644 --- a/benchmarks/benches/argon2id.rs +++ b/benchmarks/benches/argon2id.rs @@ -35,7 +35,7 @@ fn run_native(params: (i32, i32, i32)) { run_native(params.0, params.1, params.2) } -const ARGON2ID: &[u8] = include_bytes!("../../examples/rust/out/argon2id.wasm"); +static ARGON2ID: &[u8] = include_bytes!("../../examples/rust/out/argon2id.opt.wasm"); fn criterion_benchmark(c: &mut Criterion) { let params = (1000, 2, 1); diff --git a/benchmarks/benches/fibonacci.rs b/benchmarks/benches/fibonacci.rs index 61b9a68..e610ab2 100644 --- a/benchmarks/benches/fibonacci.rs +++ b/benchmarks/benches/fibonacci.rs @@ -44,7 +44,7 @@ fn run_native_recursive(n: i32) -> i32 { run_native_recursive(n - 1) + run_native_recursive(n - 2) } -const FIBONACCI: &[u8] = include_bytes!("../../examples/rust/out/fibonacci.wasm"); +static FIBONACCI: &[u8] = include_bytes!("../../examples/rust/out/fibonacci.opt.wasm"); fn criterion_benchmark(c: &mut Criterion) { // { // let mut group = c.benchmark_group("fibonacci"); @@ -58,7 +58,9 @@ fn criterion_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("fibonacci-recursive"); group.measurement_time(std::time::Duration::from_secs(5)); // group.bench_function("native", |b| b.iter(|| run_native_recursive(black_box(26)))); - group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(FIBONACCI, black_box(26), "fibonacci_recursive"))); + group.bench_function("tinywasm", |b| { + b.iter(|| run_tinywasm(black_box(FIBONACCI), black_box(26), "fibonacci_recursive")) + }); // group.bench_function("wasmi", |b| b.iter(|| run_wasmi(FIBONACCI, black_box(26), "fibonacci_recursive"))); // group.bench_function("wasmer", |b| b.iter(|| run_wasmer(FIBONACCI, black_box(26), "fibonacci_recursive"))); } diff --git a/benchmarks/benches/selfhosted.rs b/benchmarks/benches/selfhosted.rs index 441923b..adac85a 100644 --- a/benchmarks/benches/selfhosted.rs +++ b/benchmarks/benches/selfhosted.rs @@ -50,21 +50,21 @@ fn run_wasmer(wasm: &[u8]) { hello.call(&mut store, &[]).expect("call"); } -const TINYWASM: &[u8] = include_bytes!("../../examples/rust/out/tinywasm.wasm"); +static TINYWASM: &[u8] = include_bytes!("../../examples/rust/out/tinywasm.opt.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 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"); + 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))); - // group.bench_function("wasmi", |b| b.iter(|| run_wasmi(TINYWASM))); - // group.bench_function("wasmer", |b| b.iter(|| run_wasmer(TINYWASM))); + group.bench_function("tinywasm", |b| b.iter(|| run_tinywasm(black_box(TINYWASM)))); + // group.bench_function("wasmi", |b| b.iter(|| run_wasmi(black_box(TINYWASM)))); + // group.bench_function("wasmer", |b| b.iter(|| run_wasmer(black_box(TINYWASM)))); } } -- cgit v1.3.1