WASM perspectives with J2CL #204
-
Hello J2CL team, Thank you very much for the work you do and especially for WASM support. As I can see, currently JRE WASM emulation (arrays for instance) highly relies on javascript arrays via imports. So the resulting wasm can be executed only in browsers. It would be great, if one day it ll be possible to run it on the server side. Do you have any plans about WASI? PS: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
We don't rely on JavaScript arrays but we rely on stuff like String, Regex, Math. It is a subset of what you see here plus more String stuff which is hidden behind some not-yet-standardized APIs. Currently we are highly focused on browser use cases; maybe that can change in the future but not very soon. re. performance: For some data point, J2CL Wasm mode is roughly 2x faster than the JS mode for heavy computation but not for everything. JS regex is blazingly fast; much faster than re2j for average input. To put into perspective, our benchmarks shows J2CL/JS regex is 35x faster on the same input compared to re2j running on JVM. Re2j is good for guaranteed lower bounds but not for general performance. Actually Regex is one of the reasons we have pushed for first class String support in Wasm spec (so we can use JS regex from the host environment efficiently). |
Beta Was this translation helpful? Give feedback.
We don't rely on JavaScript arrays but we rely on stuff like String, Regex, Math. It is a subset of what you see here plus more String stuff which is hidden behind some not-yet-standardized APIs.
Currently we are highly focused on browser use cases; maybe that can change in the future but not very soon.
re. performance:
For some data point, J2CL Wasm mode is roughly 2x faster than the JS mode for heavy computation but not for everything.
JS regex is blazingly fast; much faster than re2j for average input. To put into perspective, our benchmarks shows J2CL/JS regex is 35x faster on the same input compared to re2j running on JVM. Re2j is good for guaranteed lower bounds but not for general …