mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-15 04:23:12 +03:00
e4fd0fccb5
This commit starts to add a page of microbenchmarks for wasm-bindgen which we can hopefully track and compare over time. Right now it's primarily focused on data collection, making it easy to collect data across a number of benchmarks for comparison. It doesn't currently do much in the way of actually comparing the results for you (aka drawing pretty graphs), so let's left for a future step. It's hoped though that we can use this to track performance improvements as well as ensuring that they work over time!
53 lines
977 B
Plaintext
53 lines
977 B
Plaintext
(module
|
|
(import "./globals.js" "jsthunk" (func $js_thunk))
|
|
(import "./globals.js" "add" (func $js_add (param i32) (param i32) (result i32)))
|
|
|
|
(export "call_js_thunk_n_times" (func $call_thunk))
|
|
(export "call_js_add_n_times" (func $call_add))
|
|
(export "thunk" (func $thunk))
|
|
(export "add" (func $add))
|
|
|
|
(func $call_thunk (param i32)
|
|
block
|
|
get_local 0
|
|
i32.eqz
|
|
br_if 0
|
|
loop
|
|
call $js_thunk
|
|
get_local 0
|
|
i32.const 1
|
|
i32.sub
|
|
tee_local 0
|
|
br_if 0
|
|
end
|
|
end
|
|
)
|
|
|
|
(func $call_add (param i32) (param i32) (param i32)
|
|
block
|
|
get_local 0
|
|
i32.eqz
|
|
br_if 0
|
|
loop
|
|
get_local 2
|
|
get_local 1
|
|
call $js_add
|
|
drop
|
|
get_local 0
|
|
i32.const 1
|
|
i32.sub
|
|
tee_local 0
|
|
br_if 0
|
|
end
|
|
end
|
|
)
|
|
|
|
(func $thunk)
|
|
|
|
(func $add (param i32) (param i32) (result i32)
|
|
get_local 0
|
|
get_local 1
|
|
i32.add
|
|
)
|
|
)
|