Hacker News new | ask | show | jobs
by CharlesW 2221 days ago
> Python in the browser is a no-go performance-wise, of course.

"Running the Python interpreter inside a JavaScript virtual machine adds a performance penalty, but that penalty turns out to be surprisingly small — in our benchmarks, around 1x-12x slower than native on Firefox and 1x-16x slower on Chrome. Experience shows that this is very usable for interactive exploration."[1][2]

[1] https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scien... [2] https://alpha.iodide.io/notebooks/300/

3 comments

So, an already slow language made slower?

No thanks.

The main point though, is that running Python in the browser it's an unnecessary abstraction because you get a crappier version of something that runs pretty well natively. If you're starting from scratch, I think that the browser might be close to native performance in some tasks. Porting existing applications is a pain when you start looking into the details.
The problem is not so much the run-time performance of the code, it's the overhead of loading the Python run-time environment over the network the first time you open the page.