web-dsp icon indicating copy to clipboard operation
web-dsp copied to clipboard

webassembly is slower than javascript

Open ghost opened this issue 7 years ago • 8 comments

I have seen a nice video which was talking about performance of web-assembly, but running your example the javascript is playing with similar speed, but on the graph it has been shown that the wasm is -97% is faster than javascript.

https://youtu.be/6v4E6oksar0?t=1796

my green line is showing 2.3, and my blue line is showing 400-500

ghost avatar Aug 23 '17 02:08 ghost

Same here. Running on chrome (on pixel) , getting a stable -28% webasm vs js.

kaminskypavel avatar Oct 17 '17 06:10 kaminskypavel

My observations of the demo, with 64-bit Firefox Nightly for Windows on a Surface Book (i7-6600U, using integrated graphics):

  • For most of the filters, WebAssembly averages 10–40% slower than JavaScript;
  • For some of the filters, WebAssembly averages −10%–40% faster than JavaScript;
  • For Super Edge, WebAssembly averages 10–20× faster than JavaScript;
  • Beards look even cooler than normal with Super Edge (though I wouldn’t want my beard to look like that in real life).

chris-morgan avatar Oct 17 '17 08:10 chris-morgan

Same. On different filters values vary between -77 to -99%.

Chrome Version 61.0.3163.100 (64 bit). Windows 10.

6matko avatar Oct 17 '17 15:10 6matko

Same here. Google Chrome. Version 62.0.3202.75 (64-Bit) Windows 10

mariohuizar avatar Oct 31 '17 19:10 mariohuizar

Same here. Google Chrome. Version 62.0.3202.75 (64-Bit) Windows 8 Generally I cannot find a single benchmark or demo where WebAssembly is faster than JS, though there are rumors and stories.. and this the videio demo.

Edit: Firefox shows similar slowness.

AllNamesRTaken avatar Nov 02 '17 11:11 AllNamesRTaken

For the simple filters like Grayscale and Invert JS is faster. Once the filters get computation complex, like Gaussian Blur WebAssembly is 50-100% faster. Which matches what you would expect because there is data transfer overhead.

Version 63.0.3239.84 (Official Build) (64-bit)

jlisee avatar Jan 12 '18 03:01 jlisee

Same on firefox, Macbook Air 2014

MarkusPfundstein avatar Feb 06 '18 23:02 MarkusPfundstein

I'm getting 40% better FPS on Gaussian Blur with JS, is it possible that Chrome has some optimization and runs the filters on the GPU?

ghost avatar Feb 26 '19 09:02 ghost