wasm-bindgen/benchmarks
2019-05-06 11:57:38 -07:00
..
src Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
Cargo.toml Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
globals.js Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
index.html Update benchmarks source code link 2019-05-06 11:57:38 -07:00
index.js Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
js-benchmarks.js Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
raw.wasm Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
raw.wast Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
README.md Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00
utils.js Add a page of microbenchmarks for wasm-bindgen 2019-05-03 12:30:11 -07:00

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 benchmarks
  • index.js - the driver JS for all benchmarks
  • globals.js - global JS functions imported by all other benchmarks
  • js-bencharks.js - the JS functions that we're benchmarking
  • src/lib.rs - the Rust/wasm-bindgen functions we're benchmarking
  • raw.wast/raw.wasm - a raw handwritten WebAssembly file used in some benchmarks. A compiled version of this is checked into the repository.