6 ms·
rust compiles to web assembly
by mlevental 9y ago
rust compiles to web assembly
- stochastic_monk 9y agoWhat kinds of things could you do with web assembly that you can’t do in native JavaScript? I know very little about web development.
- eggpy 9y agoYou can run code written in a language you are comfortable with and run web code really, really fast. It's not an "either JS or WebAssembly", they can work together. Worth reading up on if you are interested - https://developer.mozilla.org/en-US/docs/WebAssembly https://developer.mozilla.org/en-US/docs/WebAssembly
- wwweston 9y agoMostly it lets you not use JavaScript, which you may or may not be excited about, depending on how much you think the problem with web development is JS.
- ameliaquining 9y agoThere are plenty of languages that compile to JavaScript. They don't save you from having to interface with the DOM and other JavaScript APIs, but neither does WebAssembly (which currently has no such capabilities at all, save through JavaScript FFI).
- eat_veggies 9y agoIt gets you very close to native performance while running in your browser and browser sandbox. That's mind-blowing. You'd still use JS for UI stuff, but WASM lets you run algorithmic or CPU intensive tasks like e.g. games, video decoding, image resizing, AI, or anything else you need fast performance for client-side.
- FridgeSeal 9y agoThere was a demo the other day of Rust outperforming JS for stuff JS usually does. Presumably this will continue to improve, so it won't even be a case of equivalent, it'll be a case of "thoroughly beats the pants off".
- kqr 9y ago"Very close to native" means "much more efficient than JS", because JS is nowhere near native. (Have we really gone so far that people hear "native" and think of the browser? Like the web browser is the machine we target, and not the metal box the end user purchased?)
- stochastic_monk 9y agoIs it pretty easy to write C++ extensions to V8? I've seen a couple of projects of that sort. I wonder if they're relatively difficult, and if that's perhaps why the push for WebAssembly has been so strong.
- xiphias 9y agoThe Unreal engine can be used innthe browsers quite effectively thanks to WebAssembly. It would be impossible to write a modern gam in JS
- thegeekpirate 9y agoI know that the web wallet for NANO uses wasm to generate hashes, and is _much_ more performant than the JS equivalent.