4 ms·
It's more predictable, when generated from a strongly typed language. Most of the times, due to the strong typing, it is faster. However, there's a cost involv
by mankash666 8y ago
It's more predictable, when generated from a strongly typed language.
Most of the times, due to the strong typing, it is faster. However, there's a cost involved in compiling, invoking and passing data in and out of a wasm module. If the overhead cost is greater than the raw performance gain, there's no discernable difference
- uluyol 8y agoDon't forget about crossing language boundaries. Using JNI can be slower than pure Java code, and I think the same is true for wasm-js interop [1]. When wasm gets "native" access to the DOM and other browser features this may change, but until then, DOM manipulation is probably going to be faster in js. [1] someone should benchmark this.
- johncolanduoni 8y agoJNI transitions (at least on OpenJDK and Android) are much more expensive that WebAssembly<->JavaScript transitions. For the latter the same JIT is being used on both sides and there is no need for a GC transition. JNI is also far from as fast as it could be; .NET’s PInvoke is much more efficient (and easier to use).
- pjmlp 8y agoMark Reinhold already stated on a few talks, including at JavaONE that Sun designed it that way on purpose as they wanted to keep everyone true to WORA without carrying native code around. Which is also a reason why a replacement is being done as part of Project Panama, initially advocated by Charles Nutter due to the JRuby project issues. http://openjdk.java.net/jeps/191 http://openjdk.java.net/jeps/191 In alternative, if you have the source code available there is a way not to any transitions. Java now has GraalVM and .NET had C++/CLI (nee Managed C++) since the beginning.