Live data from Hacker News

WebAssembly

developer.mozilla.org

1–10 of 98 posts

Re: WebAssembly

#2
Something that I've been looking for as I try to learn more about WebAssembly is good examples of tasks that, when converted from Javascript to WebAssembly, would be good uses of WebAssembly for performance or memory or other reasons. Does anybody have a link to a blog post or good documentation like that?

Re: WebAssembly

#4
post #3

i am not looking forward to having ads delivered by binary blobs. say farewell to the age of client-side scripting.

How is this any different than getting ads from minified blobs of javascript?

Re: WebAssembly

#5
post #4
post #3

i am not looking forward to having ads delivered by binary blobs. say farewell to the age of client-side scripting.

How is this any different than getting ads from minified blobs of javascript?

i can usually block those scripts and still have a functioning page

Re: WebAssembly

#6
post #2

Something that I've been looking for as I try to learn more about WebAssembly is good examples of tasks that, when converted from Javascript to WebAssembly, would be good uses of WebAssembly for performance or memory or other reasons. Does anybody have a link to a blog post or good documentation like that?

I've experienced a 2x speedup when porting tight loops from JS to WASM. In my case, my tasks are decompression and texture decoding. I initially ported to C, and then ported to AssemblyScript, being careful to manually manage the memory along the way.

The old code was also very "tight-loop" code that's just math, and no GC allocation, so it's not applicable to many people here yet, and it's possible that JS interpreters have improved since when I ported (GC behavior has gotten quite noticeably better in V8 in the last two years), but I'll take the speedups I can get.

For comparison:

Old TypeScript: https://github.com/magcius/noclip.website/blob/master/src/Co...

New AssemblyScript: https://github.com/magcius/noclip.website/blob/master/src/as...

Wrapper for WebAssembly execution: https://github.com/magcius/noclip.website/blob/master/src/Co...

Re: WebAssembly

#8
post #2

Something that I've been looking for as I try to learn more about WebAssembly is good examples of tasks that, when converted from Javascript to WebAssembly, would be good uses of WebAssembly for performance or memory or other reasons. Does anybody have a link to a blog post or good documentation like that?

Chess websites compile their chess engines to WebAssembly so that they perform better in-browser.

Re: WebAssembly

#9
post #2

Something that I've been looking for as I try to learn more about WebAssembly is good examples of tasks that, when converted from Javascript to WebAssembly, would be good uses of WebAssembly for performance or memory or other reasons. Does anybody have a link to a blog post or good documentation like that?

Determinism! [0] I'm switching a browser game side project from Typescript to WebAssembly because determinism enables a simpler style of multiplayer. Instead of relying on a server to manage state, I can just send inputs p2p like a modern fighting game (with rollback [1]). Then the game acts just like singleplayer! For a hobbyist like me, WebAssembly makes the minefield of multiplayer so much easier to navigate.

[0]: https://github.com/WebAssembly/design/blob/master/Nondetermi... [1] A blog post on rollback netcode (not in wasm): https://ki.infil.net/w02-netcode.html

Post reply on HN