Live data from Hacker News

The Python scientific stack, compiled to WebAssembly

github.com

31–40 of 54 posts

Re: The Python scientific stack, compiled to WebAssembly

#31
post #19

This is great. Many times I wanted to showcase to colleagues who don't use Python how things would work in Python, but they don't have either Python or Jupyter installed. So I had to run Jupyter server in my own environment and give them access to it. This is quite an inconvenience as well as a security risk. Having a completely server-less Python/Jupyter environment should make this kind of showcasing much easier.

Why not show them the basics in https://repl.it/ or something similar?

Re: The Python scientific stack, compiled to WebAssembly

#32
post #20

Earlier quoted context omitted.

Well, you'd download the entire stack indeed - but not every time. Your browser does caching too.

It doesn't share the cache between the sites though. A local installation has only one runtime.

Absolutely; it's pretty much like installing an application that includes all its dependencies. Which, interestingly, is also the direction installed apps are moving towards somewhat, at least on Linux.

Re: The Python scientific stack, compiled to WebAssembly

#34
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 code for homogeneous array operations. I would love to see a minimalistic WASM implementation of numpy that can seamlessly interop with normal JS. Such a library would open up all sorts of possibilities that aren't currently feasible due to perf reasons.

Re: The Python scientific stack, compiled to WebAssembly

#35

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…

I can't believe I'm saying this but it would be neat to have a browser native BLAS, or absent that perhaps cross-compiled to WASM from a RUST implementation or something! Makes me think of all the demos like the tensorflow playground (dunno if all that happens in the browser or not).

Re: The Python scientific stack, compiled to WebAssembly

#36

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.

Re: The Python scientific stack, compiled to WebAssembly

#37
post #19

This is great. Many times I wanted to showcase to colleagues who don't use Python how things would work in Python, but they don't have either Python or Jupyter installed. So I had to run Jupyter server in my own environment and give them access to it. This is quite an inconvenience as well as a security risk. Having a completely server-less Python/Jupyter environment should make this kind of showcasing much easier.

Do they have Docker? Jupyter maintains a few docker images with various parts of the scientific stack.

Re: The Python scientific stack, compiled to WebAssembly

#38
post #37
post #19

This is great. Many times I wanted to showcase to colleagues who don't use Python how things would work in Python, but they don't have either Python or Jupyter installed. So I had to run Jupyter server in my own environment and give them access to it. This is quite an inconvenience as well as a security risk. Having a completely server-less Python/Jupyter environment should make this kind of showcasing much easier.

Do they have Docker? Jupyter maintains a few docker images with various parts of the scientific stack.

How and why would they have docker and not python. Docker's like 10 rungs up the skill ladder.

Re: The Python scientific stack, compiled to WebAssembly

#39

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.

I have used Weblas "GPU Powered BLAS for Browsers" for matrix multiply and it smokes! https://github.com/waylonflinn/weblas
Post reply on HN