In general, you get pretty good JS/wasm and wasm/JS intercalling
performance if the JS code has been jitted and accepts known types (as will
happen once you've run the code a few times), and if the JS compiler can
determine the types you'll also get good performance of the JS code. (And
if performance remains poor we'd probably like to hear about it.) If you
have a large library already and don't want to port it to C++, I would
probably stick with this code until profiling shows that the overheads are
unaffordable.
However, you're likely to see better performance by converting the code to
C++ and compiling that to wasm. Procedure call overheads will be
significantly lower - it's not cheap to cross the wasm/JS boundary even in
the best case - and the C++ compiler is likely to have more sophisticated
optimizations than the JS jit, as well as better type information to work
from, and it will need to insert no run-time type guards.
(A final possibility is to port to C++ and then compile the C++ into the
wasm engine, and invoke it using custom instructions, but this is rather a
large project.)
--lars
> _______________________________________________
> dev-tech-js-engine mailing list
>
dev-tech-...@lists.mozilla.org
>
https://lists.mozilla.org/listinfo/dev-tech-js-engine
>