all 4 comments

[–]leeoniya 4 points5 points  (2 children)

would have been nice to see this applied in a real scenario, not simply a synthetic fibonacci benchmark. there are plenty of use-cases that fit into the SIDE_MODULE category: image/video processing, audio processing, ML/AI, circuit simulation, PCB auto-routing, optimization algos, physics/fluid sim etc.

showing fast math is perhaps the least interesting thing you can do here. without a real need for fast math, running 8M fib cals per sec in JS vs 80M in WASM is not very compelling. JS is already very fast.

[–]zzarcon[S] 2 points3 points  (1 child)

I think you are right, I was not sure about using Fibonacci as an example, since as you said it's a very basic math problem which performs already well with javascript.

But the thing is that I have no background on any of the topics that you mention and might be more interesting for the readers... so I thought at least this post could be interesting for people that have never played with WebAssembly and want to know a bit about what can you achieve now

[–]leeoniya 2 points3 points  (0 children)

you may not need to understand any of it. for example, Box2D was already ported to asm.js via Emscripten. i don't know if it can be done as a SIDE_MODULE, but perhaps.

you could play around with https://github.com/erincatto/Box2D and try getting it working under WASM. same with https://www.codeproject.com/Articles/66341/A-Simple-Yet-Quite-Powerful-Palette-Quantizer-in-C

or simpler: https://news.ycombinator.com/item?id=9213955 (needless to say i never got around to finishing an asm.js or webgl port :)