Ryan Kelly
rfk.id.au · Personal blog · on HN since 2011
Ryan Kelly writes about Python, JavaScript and browser tech, notably PyPy.js, a Python JIT running in the browser.
What HN saysHN links it for PyPy.js, which the author reports can run faster than CPython after warmup; commenters discuss asm.js and JIT performance.
15HN people shared it
7linked it in comments
10stories submitted
396story points
8 years agolast shared
2011people per year2026
Most-shared posts
- 1PyPy.js: Now faster than CPython4 people · 140 points · first shared 2014 · 78 comments on HN
- 2PyPy.js Update: A Proof-of-Concept JIT3 people · 94 points · first shared 2013 · 4 comments on HN
- 3PyPy.js: First Steps2 people · 129 points · first shared 2013 · 49 comments on HN
- 4Node.js SSRF via request splitting2 people · 5 points · first shared 2018 · 2 comments on HN
- 5Compressing JavaScript2 people · 4 points · first shared 2014 · discussion on HN
- 6Are we Python yet?1 people · 16 points · first shared 2015 · 1 comments on HN
- 7CSS-3 XML Namespaces in jQuery1 people · 8 points · first shared 2011 · discussion on HN
- 8Persona identity provider1 people · first shared 2013
What HN people wrote when they linked it
corysama · 2015-02-19
These are real concerns. Asm.js is not a perfect solution. I am not Alon Zakai, but I'll try to answer to the best of my understanding.
1. Asm.js is not an alternative for a hypothetical high-performance, human-readable language in the browser. Ex: It's not competing with the idea of a C#-in-HTML JIT compiler. It is competing with Silverlight -where the browser is already downloading inscrutable binaries.
2. Emscripten has so far received the most man-years of effort, but the idea of other systems using asm.js as a compilation target is very attractive and it's not so difficult as to be a huge barrier for competition. For example https://rfk.id.au/blog/entry/pypy-js-faster-than-cpython/ (for a specific benchmark, after jit warmup). Personally, I'm excited about the idea of hooking the emscripten backend into http://terralang.org/ Terralang is a system for building custom, high-performance languages on top of LLVM.
3. Asm.js runs on any standards-compliant JS interpreter with no special support required. Even if the interpreter ignores the "use asm" directive, you can expect to see speed benefits simply from the fact that asm.js code is JS in a style that is easy to JIT very well. In order for phones, consoles, smart TVs ect... to fully benefit, it will of course require the platform holders to put in the effort to respond to "use asm". "Open Platform" doesn't mean "Works perfectly before the platform holder even implements it" ;) Also, Asm.js is not targeted to…
foldr · 2018-06-04
It's not clear to me why you think that the linked article shows that naive JITs perform better across-the-board than well-written bytecode interpreters. The reported speed improvement from JIT itself is a mere 2.3x, and the listed benchmarks mostly involve numerical code, where JIT tends to be effective.
Relevant post here:
https://rfk.id.au/blog/entry/pypy-js-faster-than-cpython/
A simple JIT can get you to the point where you reliably outperform a bytecode interpreter for certain types of code. What takes a lot more engineering effort is reliably performing at least as fast as a bytecode VM for all types of code.
RubyPinch · 2016-04-19
having a Python JITing VM written in python, compiled to javascript, can actually be faster than CPython (after warmup!)
https://www.rfk.id.au/blog/entry/pypy-js-faster-than-cpython/
voltagex_ · 2014-05-01
At a (semi-educated) guess, they've got a box (or several) running Javac 1.7.0_09 (like it says in the title) and a script that pushes stdin and stdout around and back to the web page with the results of the compilation.
Trickier ways of doing this include Emscripten [1]
1: http://www.rfk.id.au/blog/entry/pypy-js-first-steps/
philipn · 2013-08-09
If an admin could update the URL to point to http://www.rfk.id.au/blog/entry/pypy-js-poc-jit/ (w/o the anchor) that would be awesome!
kevingadd · 2013-11-27
You can absolutely do runtime code generation, you'll just be generating javascript. If you generate asm.js compatible javascript you'll be effectively JITting native code on the fly (you're just jumping through some absurd hoops to do it).
There are some proof-of-concept projects out there that do runtime generation of JS on the fly for things like recompilation and such in the browser right now. I believe Shumway [1] does it (recompiling ActionScript VM bytecode to JS on the fly) and PyPy.js has an experimental JIT too [2]. The runtime library for my compiler JSIL also does a significant amount of runtime code generation to improve performance and reduce executable sizes [3].
[1] https://blog.mozilla.org/research/2012/11/12/introducing-the-shumway-o…
[2] http://www.rfk.id.au/blog/entry/pypy-js-poc-jit/
[3] http://jsil.org/ ; https://github.com/sq/JSIL/blob/master/Libraries/JSIL.Unsafe.js#L1254 and others