News for hackers. Stuff that matters.
Re:PyPy.js: Python in the web browser by adamwiggins on Wednesday August 22, 2018 @11:56AM (#17819601)
Great project. My team used it for a live-coding Python notebook: https://github.com/inkandswitch/livebook#readme

To my surprise it was faster than Jupyter / CPython for some tasks (e.g. loading and parsing large CSVs).

Re:PyPy.js: Python in the web browser by dunpeal on Wednesday August 22, 2018 @12:10PM (#17819730)
Shouldn't be too surprising, given how PyPy is generally faster than CPython by about x7-8 factor:

http://speed.pypy.org/

I'd expect a much larger difference in tasks that are pure Python (loading a CSV is done primarily through the csv module, i.e. all the hot loops are in C).

Re:PyPy.js: Python in the web browser by icebraining on Wednesday August 22, 2018 @12:21PM (#17819828)
Yes, but PyPy is usually compiled to machine code (and emits machine code), not to JS.
Re:PyPy.js: Python in the web browser by azakai on Wednesday August 22, 2018 @12:54PM (#17820076)
True, but the asm.js is then compiled to machine code by the browser's JS JIT.

I'd expect some overhead from sandboxing etc., but it should be fairly close to native speed.

Re:PyPy.js: Python in the web browser by ris on Wednesday August 22, 2018 @05:22PM (#17822314)
It's not "overhead from sandboxing" that's a problem, it's the fact that translating from bytecode to bytecode to bytecode will cause it to lose some ... succinctness at each step, giving the final machine code generator a harder time coming up with efficient code for it.
Re:PyPy.js: Python in the web browser by dunpeal on Wednesday August 22, 2018 @12:39PM (#17819955)
Indeed, but many of the optimizations introduced by PyPy should be visible regardless of compilation target.
Re:PyPy.js: Python in the web browser by make3 on Wednesday August 22, 2018 @12:28PM (#17819879)
I love Python but js is close to an order of magnitude faster
Re:PyPy.js: Python in the web browser by icebraining on Wednesday August 22, 2018 @12:41PM (#17819976)
Have you tried PyPy?
Re:PyPy.js: Python in the web browser by weberc2 on Wednesday August 22, 2018 @12:59PM (#17820113)
Unfortunately it hasn’t been a drop-in replacement for our CPython codebase (lots of Numpy/Pandas/etc).
Re:PyPy.js: Python in the web browser by make3 on Wednesday August 22, 2018 @02:23PM (#17820732)
no numpy & no tensorflow
Re:PyPy.js: Python in the web browser by benatkin on Wednesday August 22, 2018 @02:21PM (#17820719)
Wow, that's awesome! Direct link to the live notebook: https://livebook.inkandswitch.com/fork/welcome

Naturally, I changed the first code block to this:

    from random import randint, seed
    seed()
    "\n".join([randint(5, 25) * ' ' + s for s in ['such code', 'much live', 'wow']])
Re:PyPy.js: Python in the web browser by bmays on Wednesday August 22, 2018 @01:32PM (#17820338)
This is great, was looking for this exactly!