.. | ||
src | ||
Cargo.toml | ||
globals.js | ||
index.html | ||
index.js | ||
js-benchmarks.js | ||
raw.wasm | ||
raw.wast | ||
README.md | ||
utils.js |
Microbenchmarks for wasm-bindgen
This folder houses a number of microbenchmarks for wasm-bindgen
. These, like
all microbenchmarks, should be taken with a grain of salt. They are intended to
help developers understand changes over time, but they are not intended to be a
performance suite for WebAssembly for Rust.
View benchmarks for master
branch online
Building and Running
First, copy the benchmarks to a temporary directory:
$ cp ./benchmarks /some/other/directory
Next, cd
into that directory and execute:
$ wasm-pack build --target web
Next, use your favorite static file server to host the current directory. For
example using the https
crate:
$ http
Then open up a web browser and view http://localhost:8000, for example.
You should be presented a page with lots of (run)
links, where when you click
them it will execute the benchmark and then display the result.
Benchmark Architecture
Currently benchmarks are pretty bare bones. They just use benchmark.js to
generate statistics which are then rendered to the screen. Benchmarks are listed
one-by-one in index.html
where a td
exists for each benchmark. In index.js
each of the td
's id
properties are hooked up to an actual function to
benchmark, depending on what's being benchmarked.
Relevant files are:
index.html
- the page showing all benchmarksindex.js
- the driver JS for all benchmarksglobals.js
- global JS functions imported by all other benchmarksjs-bencharks.js
- the JS functions that we're benchmarkingsrc/lib.rs
- the Rust/wasm-bindgen
functions we're benchmarkingraw.wast
/raw.wasm
- a raw handwritten WebAssembly file used in some benchmarks. A compiled version of this is checked into the repository.