Updated JavaScript interpreter to help boost WebKit’s performance by 2, 2.5x

Posted by:
Date: Friday, March 2nd, 2012, 08:22
Category: iOS, News, Software

You can’t argue that WebKit’s been good for Apple and iOS in general.

Apple’s WebKit JavaScriptCore is now a “triple tier virtual machine,” offering the potential for 2-2.5 times faster JavaScript performance in Safari.

Per webkit.org, recent changes in Apple’s WebKit open source project (used by Safari on OS X and iOS, and to power a wide variety of other browsers) include the incorporation of the efficient new LLInt (Low Level Interpreter), which is now used by JavaScriptCore (JSC) to attempt executing code before passing it to the standard interpreters, either the bytecode virtual machine or the JIT (Just In Time complier) which builds native machine code on the fly.

“JSC will now will start by executing code in LLInt and will only tier up to the old JIT after the code is proven hot,” a change report on the new interpreter describes.

“LLInt is written in a modified form of our macro assembly. This new macro assembly is compiled by an offline assembler (see offlineasm), which implements many modern conveniences such as a Turing-complete CPS-based macro language and direct access to relevant C++ type information (basically offsets of fields and sizes of structs/classes).”

The new interpreter “is 2-2.5x faster than our old interpreter on SunSpider, V8, and Kraken [benchmarks],” the report states. “With triple-tiering turned on [to allow the LLInt to interpret code], we’re neutral on SunSpider, V8, and Kraken, but appear to get a double-digit improvement on real-world websites due to a huge reduction in the amount of JIT’ing.”

JavaScript performance in web browsers is a primary focus for optimization, as the faster and more efficiently code can be executed, the more fluid animations can run and the more sophisticated and responsive cross platform web applications can be.

The LLInt enhancements to JavaScriptCore appear to have been contributed by Filip Pizlo, who joined WebKit as a reviewer in December after acting as a “major contributor” to improvements to the JavaScriptCore JIT and Garbage Collector. Pizlo filed a bug report in January noting that “JSC should be a triple-tier VM,” and subsequently solved the issue by the end of February.

The new changes to JavaScriptCore will take some time to make it into the mainstream version of Safari, following similar WebKit enhancements of previous years. Enhancements in Apple’s next release of Safari 5.2 have been profiled in reports describing its new user interface and sharing enhancements and new privacy settings and website alert features.

In 2008, WebKit announced a rewriting of JavaScriptCore as a direct-dispatch register based, high-level bytecode virtual machine originally named SquirrelFish. It compiled JavaScript into native machine code. The project was later enhanced to gain the codename SquirrelFish Extreme.

Stay tuned for additional details as they become available.

Recent Posts