3 ms·
> you have to do a bunch of analysis to figure when something is being used as an integer and then you can make that code fast It doesn't get much attention no
by MaxBarraclough 2y ago
> you have to do a bunch of analysis to figure when something is being used as an integer and then you can make that code fast
It doesn't get much attention now that WASM exists, but asm.js essentially solves this, so a more head-to-head comparison ought to be possible. (V8 has optimisations specific to asm.js.)
https://en.wikipedia.org/wiki/Asm.js https://en.wikipedia.org/wiki/Asm.js
- IainIreland 2y agoasm.js solves this in the specific case where somebody has compiled their C/C++ code to target asm.js. It doesn't solve it for arbitrary JS code. asm.js is more like a weird frontend to wasm than a dialect of JS.
- lern_too_spel 2y agoNo, if you just use the standard JavaScript cast to integer incantation, |0, v8 will optimize it. asm.js is valid JavaScript.
- MaxBarraclough 2y agoSure, but that was essentially my point. If we're trying to compare HotSpot and V8 for similar input code, Java and asm.js seem closer than Java and full-blown JavaScript with its dynamic typing.