Native code function call overhead vs webassembly

Bellaz89 <[email protected]> Sun, 7 Mar 2021 23:57:20 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
Hi everyone,

I am working with an application that uses SM78 as its scripting engine. This application has a bunch of mathematical libraries in pure JS that I want to port to emscripten/webassembly. I see that some years ago progress was made in improving the call overhead between JS <-> webassembly (https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast-%F0%9F%8E%89/). This is highly beneficial for me. However, I wonder how this compares to functions/modules implemented using the native code interface in C++. How much is the native code call overhead? How does it compare to webassembly? Is there an advantage in using one solution (wasm or native c++) for 'short' functions?

Thanks in advantage and sorry if the question is a bit vague.

Andrea