News for hackers. Stuff that matters.
Re:Replacing JavaScript Hot Path with WebAssembly by bufferoverflow on Thursday February 14, 2019 @07:47PM (#19167578)
Or better yet, WebGL should be able to do this in a few ms on a GPU.
Re:Replacing JavaScript Hot Path with WebAssembly by olliej on Thursday February 14, 2019 @09:24PM (#19167984)
Or simply use the canvas api, which has super optimized graphics libraries behind it - rather than reimplementing the wheel :)

But I get that really this was a how much can wasm help performance as % vs js - you could always write an “optimized” routine and compare those and theoretically achieve something similar.

Re:Replacing JavaScript Hot Path with WebAssembly by bzbarsky on Thursday February 14, 2019 @10:53PM (#19168346)
The article mentions why they couldn't use canvas for this: they are running this code in a worker, and canvas support in workers is not great in browsers so far.
Re:Replacing JavaScript Hot Path with WebAssembly by jaffathecake on Friday February 15, 2019 @03:28AM (#19169367)
Not only that, there's a nasty bug in Chrome that makes it unusable for our use-case https://bugs.chromium.org/p/chromium/issues/detail?id=906619
Re:Replacing JavaScript Hot Path with WebAssembly by olliej on Thursday February 14, 2019 @11:00PM (#19168366)
Ah my bad for skimming - I though most canvas stuff worked these days? (I recall many years ago when I worked on such things that fonts were the biggest problem, but also people generally wanting to be able to paint dom elements in their as well)
Re:Replacing JavaScript Hot Path with WebAssembly by Technetium_Hat on Saturday February 16, 2019 @01:03PM (#19179898)
It is OffScreenCanvas, the variant that works in web workers, that has poor browser support.
Re:Replacing JavaScript Hot Path with WebAssembly by robko on Friday February 15, 2019 @03:25AM (#19169359)
In my experience, the canvas api is very slow and not well thought-out. For example, to create a native image object from raw pixels, you have to copy the pixels into an ImageData object, draw it to a canvas, create a data URL from the canvas and then load an image from that data URL.