The speed is surprisingly reasonable. Testing with a simple loop, I get about 1.3-1.4 million loops per second in python3, 2 million loops per second in python2, 14.5 million loops in pypy, and 0.61 million loops in the browser. My code basically calls int(time.time()) until its value changes, doing i+=1 for every time it did not change (n=10 for every platform (python2/3/pypy/browser)). My browser is Firefox 61, ful…
Fetching time in the browser isn't accurate because a lot of trackers exploit timing in order to fingerprint users. A lot of browsers now purposefully reduce the precision of the clock. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... https://johnresig.com/blog/accuracy-of-javascript-time/
PyPy.js: Python in the web browser
121–129 of 129 posts
Re: PyPy.js: Python in the web browser
#122Re: PyPy.js: Python in the web browser
#123Will web assembly have any effect on a future web based python interpreter? Is there one in the works?
Re: PyPy.js: Python in the web browser
#124Will web assembly have any effect on a future web based python interpreter? Is there one in the works?
Re: PyPy.js: Python in the web browser
#125I tried to do a little something with Emscripten and WebAssembly, but I stopped on the sockets implementation. It relies on WebSockets. I wonder how well we could emulate real sockets using WebRTC to make WebAssembly apps more sophisticated.
Re: PyPy.js: Python in the web browser
#126Would it be sane to use this to run Python modules in node.js?
A) Run it as a subprocess
B) Call it over HTTP request/response
C) Use a message broker like AMQP
Re: PyPy.js: Python in the web browser
#127It's really awesome to see how far this has come. I believe we at Repl.it were the first to try something like this in production. We emscriptined CPython to JavaScript and contributed quite a bit to the project in the process (including the initial virtual filesystem implementation). https://github.com/replit-archive/empythoned I deployed this at scale at Codecademy were millions of users were using it to learn Pyth…
Re: PyPy.js: Python in the web browser
#128Earlier quoted context omitted.
I think we're roughly already there. I think the pivotal moment where Python 2 could've died out rapidly passed and they kept officially supporting it for too long.
As far as I know, permanent EOL for Python 2 is still Jan 1, 2020 ( https://pythonclock.org/ ). Python 3 was first released December of 2008. That's an awfully long tail.
> Specifically, 2.7 will receive bugfix support until January 1, 2020. All 2.7 development work will cease in 2020.
> I've updated the PEP to say 2.7 is completely dead on Jan 1 2020. The final release may not literally be on January 1st, but we certainly don't want to support 2.7 through all of 2020.
https://www.python.org/dev/peps/pep-0373/#maintenance-releas... https://mail.python.org/pipermail/python-dev/2018-March/1523...
Re: PyPy.js: Python in the web browser
#129Earlier quoted context omitted.
Fetching time in the browser isn't accurate because a lot of trackers exploit timing in order to fingerprint users. A lot of browsers now purposefully reduce the precision of the clock. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... https://johnresig.com/blog/accuracy-of-javascript-time/
Oh, how convenient. Sometimes I wonder if we shouldn't find a way to be able to run trusted applications instead of making everyone's life difficult all the time, and that's speaking as a security consultant, not even a developer... but yeah I don't see a good way to make that happen.