Re:Web Assembly and Go: A look to the future
by erikpukinskis on Saturday June 23, 2018 @12:45PM
(#17382046)
It’s not necessarily any faster. You can shoot yourself in the foot quite easily too, performance wise.
[ Parent
| on HN ]
Re:Web Assembly and Go: A look to the future
by mankash666 on Saturday June 23, 2018 @01:51PM
(#17382394)
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
Re:Web Assembly and Go: A look to the future
by uluyol on Saturday June 23, 2018 @02:00PM
(#17382448)
Don'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.
Re:Web Assembly and Go: A look to the future
by johncolanduoni on Saturday June 23, 2018 @05:59PM
(#17383683)
JNI 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).
Mark 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
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.