4 ms·
Wasm can't do anything JS couldn't do already.
by dagmx 6y ago
Wasm can't do anything JS couldn't do already.
- ttt0 6y agoWhat JS can do is already bad enough.
- yjbanov 6y agoThere are a few things that WASM can do that JS can't (at least not now): - Memory management without GC - Unboxed data structures - SIMD - Shared-memory multi-threading - Precompiled snapshots (does not need to be recompiled on page reload)
- dagmx 6y agoI should clarify, in the context of the reply I was referring to security. Wasm is inherently as secure as JavaScript.
- hajile 6y agoBytecode caching has been a browser feature for years[0] JS has atomics and shared memory arrays which also basically bypass garbage collection [1] JS had working simd.js implementations in both Firefox and Chrome until they were pulled in favor of WASM [0] https://v8.dev/blog/code-caching-for-devs https://v8.dev/blog/code-caching-for-devs [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [2] https://github.com/tc39/ecmascript_simd https://github.com/tc39/ecmascript_simd https://blog.mozilla.org/javascript/2015/03/10/state-of-simd-js-performance-in-firefox/ https://blog.mozilla.org/javascript/2015/03/10/state-of-simd... https://01.org/blogs/2014/bringing-simd-javascript https://01.org/blogs/2014/bringing-simd-javascript
- AlchemistCamp 6y agoIt can do integers.
- hajile 6y agoBigInt landed in ES2020 and has been supported in something like the last 10-20 versions of Chrome and Firefox, so no huge worries about using it (the "current" browser without support is IE11). The `123|0` type hint is also recognized and implemented by most browsers too. It forces a 31-bit integer on most platforms (and can offer a significant performance boosts if you're running a tight algorithm). https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...