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

Support for trigonometric functions #1503

Open
JeromeDesfieux opened this issue May 5, 2023 · 2 comments
Open

Support for trigonometric functions #1503

JeromeDesfieux opened this issue May 5, 2023 · 2 comments

Comments

@JeromeDesfieux
Copy link

From my understanding, WebAssembly does not provide built in functions for trigonometry.
And as a consequence, the performance of such functions when porting from C++ (with Emscripten using musl implementation) are very bad. JavaScript is very much better.

That would be extremely nice if such functions can be builtin in WebAssembly. One of application domain of WebAssembly is running 3D/Graphics apps in near native C++ performance which is using a lot of trigonometry.

Please see emscripten-core/emscripten#19284 for more details and measures.

@pannous
Copy link

pannous commented May 5, 2023

nothing prevents the compiler from emitting fast implementations with different precision, depending on the context?

as a more general approach thanks to the component model, wasm interpreters and bytecode compilers could completely replace functions with internal opcodes, if the name and signature are matched

@JeromeDesfieux
Copy link
Author

Thanks for your answer. I looked to musl trig functions and they are very similar to the ones in V8 engine for example.
I don't really get why this performance impact (but I am newbie in wasm and compiler domain, maybe I miss something).
Of course I could implement faster methods and less accurate to compensate but that was not my intend.

as a more general approach thanks to the component model, wasm interpreters and bytecode compilers could completely replace functions with internal opcodes, if the name and signature are matched

Can you give a link to a doc that might help me in understanding this approach ? Thanks.

@sunfishcode sunfishcode transferred this issue from WebAssembly/proposals Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants