Thursday, October 8, 2015

Jitterdämmerung

Marcel Weiher (tweet, comments):

With Apple doggedly sticking to Ahead of Time Compilation for Objective-C and now their new Swift, JavaScript is pretty much the last mainstream hold-out for JIT technology. And even in JavaScript, the state-of-the-art for achieving maximum performance appears to be asm.js, which largely eschews JIT techniques by acting as object-code in the browser represented in JavaScript for other languages to be AOT-compiled into.

I think this shift away from JITs is not a fluke but was inevitable, in fact the big question is why it has taken so long (probably industry inertia). The benefits were always less than advertised, the costs higher than anticipated. More importantly though, the inherent performance characteristics of JIT compilers don’t match up well with most real world systems, and the shift to mobile has only made that discrepancy worse. Although JITs are not going to go away completely, they are fading into the sunset of a well-deserved retirement.

2 Comments RSS · Twitter


Ahead-of-time compiled JavaScript would a few times slower that JIT. This is dictated by the atrocious design of the language.

Type inference can happen mostly at runtime, the JIT can optimize for that. Ahead-of-time compiler would have to drive blindly in the same area of the code.

Now, ahead-of-time compilation is consuming much less memory, and is more predictable. But won't be faster.

Along these lines are conversations I have with a friend of mine who works on this now:
https://github.com/tmikov/jscomp


But the really high performance option for JavaScript is asm.js, isn't it? And now we're looking at WebAssembly...

Leave a Comment