Skip to content

Commit 7dc7632

Browse files
authored
Simplify the counter benchmark (#1874)
simplify the counter benchmark
1 parent 327e748 commit 7dc7632

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

crates/wasmi/benches/benches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ fn bench_execute_counter(c: &mut Criterion) {
921921
let run = instance.get_typed_func::<i32, i32>(&store, "run").unwrap();
922922
b.iter(|| {
923923
let result = run.call(&mut store, ITERATIONS).unwrap();
924-
assert_eq!(result, ITERATIONS);
924+
assert_eq!(result, 0);
925925
})
926926
});
927927
}
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
(module
22
(func (export "run") (param $n i32) (result i32)
3-
(local $i i32)
43
(loop $continue
54
(br_if
65
$continue
7-
(i32.ne
8-
(local.tee $i
9-
(i32.add
10-
(local.get $i)
11-
(i32.const 1)
12-
)
6+
(local.tee $n
7+
(i32.sub
8+
(local.get $n)
9+
(i32.const 1)
1310
)
14-
(local.get $n)
1511
)
1612
)
1713
)
18-
(return (local.get $i))
14+
(return (local.get $n))
1915
)
2016
)

0 commit comments

Comments
 (0)