Skip to content
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

how to run in optimized mode ? #104

Open
zapashcanon opened this issue Oct 11, 2024 · 2 comments
Open

how to run in optimized mode ? #104

zapashcanon opened this issue Oct 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@zapashcanon
Copy link

zapashcanon commented Oct 11, 2024

Hi,

I'm making some benchmarks and I'd like to be sure to run wsoo with the best possible performances. For now I'm doing:

$ ocamlc ./kb.ml
$ wasm_of_ocaml compile --opt=3 a.out
$ node a.js

But the results seem slower than what I would expect on some tests:

$ ./bench.sh
*** Running Knuth-Bendix
Wasocaml (node):            real 1.00 user 1.35 sys 0.06
Wasocaml + wasm-opt (node): real 0.99 user 1.37 sys 0.04
OCaml native:               real 0.67 user 0.66 sys 0.00
OCaml bytecode:             real 2.77 user 2.76 sys 0.00
js_of_ocaml (node):         real 24.62 user 25.39 sys 0.16
wasm_of_ocaml (node):       real 8.18 user 8.50 sys 0.06

Is there anything else I should do to get better performances from wsoo? From my understanding it calls Binaryen itself and I should not have to do it myself, is this right?

Thanks!

(For some reason the bug label has been added when I created the issue and it seems I can't change it..)

@zapashcanon zapashcanon added the bug Something isn't working label Oct 11, 2024
@OlivierNicole OlivierNicole added question Further information is requested and removed bug Something isn't working labels Oct 14, 2024
@OlivierNicole
Copy link
Collaborator

Is there anything else I should do to get better performances from wsoo? From my understanding it calls Binaryen itself and I should not have to do it myself, is this right?

Yes. You can pass --debug binaryen to know exactly how Binaryen is invoked.

Interesting result! Four times slower than bytecode is certainly not typical. The first thing I would do would be to use Chrome’s profiler to inspect both the Wasocaml-compiled and the wasm_of_ocaml-compiled program and try to determine where the slowdown is located with wasm_of_ocaml. If you want to do it, or want to share the source program, we would be grateful!

@vouillon
Copy link
Collaborator

This is an exception-heavy benchmark. The implementation of exceptions in the V8 engine is quite slow.
I guess Wasocaml does not use Wasm exceptions but implements its own exception mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants