wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Is a wasm-bindgen-bench crate possible today?

Open chinedufn opened this issue 5 years ago • 4 comments

I know that you can write your own test runners, but could you also do this:

#[wasm_bindgen_bench]
fn my_benchmark() {
  // ...
}

?


The impetus here is me working on a renderer and wanted an easily compare potential performance enhancements in real browsers.

Something like this would make that trivial... but I don't know if this is even technically possible at this time?

Cheers!

chinedufn avatar Sep 14 '18 09:09 chinedufn

It should be possible, yes! I've been thinking about trying to port criterion over to wasm: https://docs.rs/criterion/0.2.5/criterion/

fitzgen avatar Sep 14 '18 15:09 fitzgen

Woah smooth - thanks a lot for the link!

I'm curious - in your mind is it more or less a straight up port or are there a bunch of wasm specific considerations that would come into play?

In the meantime I'll give criterion and wasm-bindgen-test a read to get more familiar...

Should this issue be left open to maybe lay out what benchmarking support might look like?

chinedufn avatar Sep 14 '18 16:09 chinedufn

I haven't looked into criterion's code at all yet, just something in the back of my mind. I've only used it, and been very pleased with the result.

Yeah, we can keep this issue open to discuss :)

fitzgen avatar Sep 14 '18 21:09 fitzgen

Does the new WASM support of criterion have any impact to this issue?

flosse avatar Mar 04 '22 02:03 flosse