Skip to content

Commit cce2064

Browse files
author
Arnaud Riess
committed
feat: enhance benchmarking for Fibonacci functions in herkos runtime
1 parent 67bf6e2 commit cce2064

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

crates/herkos-tests/benches/herkos_runtime_benchmark.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,33 @@ use criterion::{criterion_group, criterion_main, Criterion};
22
use herkos_tests::*;
33
use std::hint::black_box;
44

5-
fn fibo_wasm_bench(c: &mut Criterion) {
5+
fn fibo_5_wasm_bench(c: &mut Criterion) {
6+
let mut m = rust_e2e_arith::new().unwrap();
7+
c.bench_function("fib 5 wasm transpiled to rust", |b| {
8+
b.iter(|| m.fibo(black_box(5)))
9+
});
10+
}
11+
12+
fn fibo_5_orig_bench(c: &mut Criterion) {
13+
c.bench_function("fib 5 plain rust", |b| b.iter(|| fibo_orig(black_box(5))));
14+
}
15+
16+
fn fibo_20_wasm_bench(c: &mut Criterion) {
617
let mut m = rust_e2e_arith::new().unwrap();
718
c.bench_function("fib 20 wasm transpiled to rust", |b| {
819
b.iter(|| m.fibo(black_box(20)))
920
});
1021
}
1122

12-
fn fibo_orig_bench(c: &mut Criterion) {
23+
fn fibo_20_orig_bench(c: &mut Criterion) {
1324
c.bench_function("fib 20 plain rust", |b| b.iter(|| fibo_orig(black_box(20))));
1425
}
1526

16-
criterion_group!(benches, fibo_wasm_bench, fibo_orig_bench);
27+
criterion_group!(
28+
benches,
29+
fibo_5_wasm_bench,
30+
fibo_5_orig_bench,
31+
fibo_20_wasm_bench,
32+
fibo_20_orig_bench
33+
);
1734
criterion_main!(benches);

0 commit comments

Comments
 (0)