Description
Emscripten version: 3.1.35
Tests done on Windows desktop i7 12th 32GB RAM (native compiler is MSVC 2022, brower Chrome for wasm tests)
Build configuration is RelWithDebInfo (O2) for native and wasm builds
I am doing some benchmark and I am very surprised with the results I have regarding the performance of the trigonometric functions (math.h
).
Basically I wrote a program doing a conbination of atan2, cos and sin that I execute on a test data.
I have the following results on my computer:
- Native C++: 1.7 ms
- WebAssembly: 3 ms
- JavaScript: 2 ms
I tried many other approach for this test (including Catch2 benchmark and using a non-sorted dataset) and I have always very bad results with WebAssembly (approx. 50% slower than JS).
Is there is a known reason for that ? Can I improve ?
(Please find attached the source code)
Benchmark_trigo.zip