Live data from Hacker News

The Python scientific stack, compiled to WebAssembly

github.com

51–54 of 54 posts

Re: The Python scientific stack, compiled to WebAssembly

#51

I benchmarked this recently. It comes in at 4-10x slower than cpython for random typical use cases on my machine, which is not too shabby at all. The author also states that numpy is slower than it should be due to lack of support for BLAS at this time. The real impressive feat to me isn't hosting jupyter in the browser. It's access to a reasonably fast implementation of numpy in the browser which smokes native JS co…

Interesting, how do you derive at "4-10x slower"? Running the exported notebook here takes time py3 python.py real 0m0.145s chrome: load html: 2sec run html: 13sec! That's not 10 times slower, but a 100 times slower! Still good start.

[deleted]

Re: The Python scientific stack, compiled to WebAssembly

#53

I benchmarked this recently. It comes in at 4-10x slower than cpython for random typical use cases on my machine, which is not too shabby at all. The author also states that numpy is slower than it should be due to lack of support for BLAS at this time. The real impressive feat to me isn't hosting jupyter in the browser. It's access to a reasonably fast implementation of numpy in the browser which smokes native JS co…

Numpy is fast thanks to having much of its code compiled as a native library.

They were purposefully working to reduce abstraction, since performance mattered from day one.

WASM is a huge step backwards in that regard. If you care about performance, just install Python on your box and "pip install numpy". Do you absolutely have to have it come in a browser now?

Re: The Python scientific stack, compiled to WebAssembly

#54
post #9

Is there a performance hit compared to "native" Python?

Certainly for anything using Numpy.

Actually, Numpy-using-code is closer to native speeds than pure Python is.

The thing that seems to cause a greater gap between wasm and native speeds is lots of Python-level function calls, not the tight C loops that make up much of Numpy.

Post reply on HN