5 ms·
Sorry for the noob question but what can you do with web assembly that you wouldnt otherwise do with other web frameworks? What are people using web assembly fo
by eachro 4y ago
Sorry for the noob question but what can you do with web assembly that you wouldnt otherwise do with other web frameworks? What are people using web assembly for generally?
- ultra_nick 4y agoYou can't compile existing C++ or Rust programs to React or other frameworks. It's used to compile your app in a format that can run on any machine with a web browser.
- vbezhenar 4y agoWebAssembly brings absolutely zero new features to web. You can get predictable performance for some code and that's about it. Think about it as an optimisation. There's much more hype than essence there. You could compile C++ or Java to JavaScript 10 years ago. Bellard's jslinux was implemented with JavaScript originally and it was enough to emulate x86 in the browser.
- flohofwoe 4y ago> You could compile C++ ... to JavaScript 10 years ago. That's true, but to get any sort of 'near-native' performance out of that approach, browsers had to add special support for asm.js, running asm.js as regular Javascript would loose 3..10x performance compared to 'special cased' asm.js (if I remember right - for instance iOS Safari never added this special asm.js support, and once it supported WASM the performance jump from asm.js to WASM was dramatic and much bigger than desktop browsers which already had added special asm.js support before). Compared to an asm.js special case in a Javascript engine, the WASM approach just makes a lot more sense, because Javascript can now focus again on being a programming language and not also being a good compile target.
- kevingadd 4y agoIt's hard to overstate how much faster WebAssembly is compared to what we had before the advent of asm.js. It's so much faster that it really does enable you to do things you couldn't do before because it was too slow. Also, WASM does expose things that (afaik) aren't available in JS, like int64, SIMD, atomics, etc.
- rikroots 4y agoIt's useful for getting the MediaPipe Selfie-Segmentation model running in the browser - https://codepen.io/kaliedarik/pen/PopBxBM https://codepen.io/kaliedarik/pen/PopBxBM
- flohofwoe 4y agoI use it for my home computer emulation stuff, the same code also compiles to minimal native applications (but with WASM there's not much of a point except during development and debugging - still it's good to have a "native fallback"): https://floooh.github.io/tiny8bit/ https://floooh.github.io/tiny8bit/ Also see: https://github.com/floooh/sokol https://github.com/floooh/sokol and https://floooh.github.io/sokol-html5/index.html https://floooh.github.io/sokol-html5/index.html. (e.g. for me it's a way to easily get my C/C++ cross-platform hobby stuff to people without requiring them having to jump through the hoops of downloading and running an untrusted native executable or messing around with C/C++ toolchains and build systems to build the stuff locally). PS: WASM in the browser is also a good watchdog which punishes you heavily if your code gets to bloated ;)