3 ms·
It is a waste of power (currently). But you can have native performance on a virtual machine by translating your VM code to machine code and just running the m
by 3cats-in-a-coat 3y ago
It is a waste of power (currently).
But you can have native performance on a virtual machine by translating your VM code to machine code and just running the machine code. There are ways to sandbox without interpretation. WASM goes to some extent in that direction, but not all the way, mostly for safety.
So it wastes some power. The question is: so what? WASM is attractive because it's an instant deployment. You open a URL, boom. Nothing to explicitly download, install and launch. Nothing to maintain. And eventually uninstall. It removes the friction for apps you use once in a while, or... just once, even.
In engineering & design, efficiency comes in many kinds. You waste power on the user's machine, but you got your foot in the doorstep by them opening your URL and running your app. It's not how many of us, including me, want the world to be, but it... be how it be.
P.S.: The real flip-side is when sites start figuring out ways en masse to profit from your compute by visiting their sites. Crypto mining as one example. Oh well.
- AlotOfReading 3y agoYou don't get "native performance" (as in the speed that a native application would run) even with JIT. You still need to implement the semantics of the virtual machine, and generate the native code, add safety guardrails for memory safety, etc. The Hotspot JVM is a world class implementation that does all of that well and still loses to C/C++ outside specialized benchmarks.
- kaba0 3y agoThe JVM has different semantics than C/C++, so it is not an apt comparison. Asymptotical performance-wise there is nothing inherent with a JIT compiler that would put it behind an AOT one.