The Mozilla Foundation is on the verge of adopting a new software-programming technique that promises to dramatically improve the speeds at which browsers interact with the Web. The first step, the nonprofit organization said, will be to optimize the way that JavaScript runs in Firefox 3.1 — the next incremental update to Mozilla’s popular open-source browser.
Originally developed by Netscape and currently maintained by Mozilla, JavaScript is a powerful cross-platform scripting language that is already used in millions of Web pages and server applications worldwide. Moreover, the scripting language’s deployment in Internet applications such as Firefox is driven by an embeddable JavaScript engine that Mozilla calls SpiderMonkey.
Earlier this summer, Mozilla engineers launched a new project called TraceMonkey that promises to revolutionize Web-browser performance, noted Mike Shaver, Mozilla’s vice president of engineering.
“Based on a technique developed at UC Irvine called ‘trace trees,'” Shaver said, “a few of us have spent the last two months — and most of the last few nights — teaching SpiderMonkey some exciting new tricks.”
Hot Code Paths
University of California researchers have succeeded in building a compiler featuring the ability to dynamically detect frequently executed byte-code instructions and then generate code on the fly for exactly these hot code paths, called “traces.”
“Tracing follows only the hot paths, and builds a trace-tree cache,” noted Mozilla CTO Brendan Eich. Given that “cold code never gets traced,” memory bloat is avoided, he explained.
The early results from Mozilla’s ongoing TraceMonkey project — which adds native code compilation to the organization’s SpiderMonkey engine — takes JavaScript performance to “another level, where instead of competing against other interpreters, we start to compete against native code,” Shaver said. “Even with this very, very early version, we’re already seeing some promising results.”
TraceMonkey employs a new kind of just-in-time compiler to boost JavaScript performance by…