-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for wasm32-wasi #461
Comments
Hello! Thanks for trying Criterion.rs and thanks for the suggestion. Benchmarking in WASM is not supported by Criterion.rs. I don't even know what would be required to support such. If you really want to blaze that trail yourself and the changes needed aren't too onerous to maintain, I would be open to pull requests though. I am very skeptical that Criterion.rs can give you reasonable measurements though. JIT compilers add a whole extra level of unreliability to benchmarking results that Criterion.rs' analysis can't really do anything to mitigate. They sometimes make different optimization decisions each time you re-launch the VM. |
Thanks @bheisler for the fast response and your work on criterion.rs! I actually managed to hack something together using this PR as the It still fails with the following stacktrace:
The problem is that wasm doesn't have threading support yet. I'm not sure if you can configure cirterion to run in a single threaded environment? But apart from this everything else looks good. I would say that the only change needed is updating plotters and adding single threaded support. I would need to first get a bit more familiar with the codebase, but if you think that this changes are ok I could submit a PR eventually. Regarding the measurement precision, there are many Wasm runtimes and compilers out. Some, like LLVM and Cranelift are able to pre-compile your .wasm file to an executable so you avoid the uncertainty of JIT. This would make criterion a great tool to compare native vs wasm code and the different compilers. |
Currently no, it's not possible to run without thread support. You would need to implement alternate versions of the functions that currently rely on Rayon, and then tag them with the appropriate |
@bkolobara feel free to share your fork. At the moment there's no benchmarking for stable wasm, would be great to have something work. |
A basic version of this is now operational. I'd like to see it included in the upcoming 0.4 release.
It works because |
Hey everyone! Are there any updates on this? |
We use this branch for lunatic apps compiled to [dev-dependencies]
# WASI branch
criterion = { git = "https://github.com/bheisler/criterion.rs", branch = "version-0.4", default-features = false } |
WASM support will be part of the upcoming 0.4 release. |
I'm trying to get criterion running on Wasmtime and Wasmer after compiling the application to
target=wasm32-wasi
.There is already an issue about getting it running in the browser with
wasm-bindgen
, but I think that it would be actually more beneficial to get WASI support first. Especially because the WASI specification exposes a higher precision clock and there is currently no alternative to measure performance inside these Wasm runtimes.I ran into an issue with the plotters dependency and this is currently my main blocker.
The text was updated successfully, but these errors were encountered: