I think that’s a hard question to give a good answer to; ultimately it’s going to be hugely use-case dependent. Let’s say you’re considering wrapping an external library vs. compiling said library to wasm and using it that way.
Consider for example the
JSNative signature, used by
using JSNative = bool (*)(JSContext* cx, unsigned argc, JS::Value* vp);
So, if your library needs arguments, you’ll need to extract the JS args and coerce them into types your library uses; at this point we’re into a philosophical question: Is that argument manipulation ‘call overhead’ or not?
Really, I suspect the only good answer here is: your mileage will almost certainly vary based on application.
There are other considerations that might push you in one direction or another, but if ‘how many calls can I issue per second’ is the defining one, the only answer I have is: you’re going to have to benchmark .