Firefox to Gulp JavaScript Faster With New TraceMonkey Feature

Mozilla has announced the launch of a new feature for its Firefox Web browser designed to make it perform faster. Called “TraceMonkey,” the feature is an evolution of Firefox’s SpiderMonkey JavaScript engine and will be built into Firefox 3.1, according to the company.

To increase JavaScript speeds by an order of magnitude or more, Mozilla designed TraceMonkey with a new type of just-in-time compiler.

The company has measured speeds up to 37.5 times faster for specific “micro-benchmarks,” according to Brendan Eich, Mozilla’s chief technology officer. Determining browser speed depends a lot on what benchmarks are used, however, and he acknowledged that Mozilla has detected less of a speed boost by other standards.

“It’s early yet, and we expect further speed improvements in the near term,” he told the LinuxInsider.

Users eager to put TraceMonkey to the test can do so, Eich added. “TraceMonkey can be used in developer builds now, but you have to enable it using a hidden preference. It will be enabled by default for Firefox 3.1.”

Speed Demon

During the past year, JavaScript performance on the Web has undergone significant changes, with every browser improving its JavaScript engine to boost execution speed, writes Mike Shaver, vice president of engineering, on the Mozilla blog.

“Firefox is about three times faster than Firefox 2 in various JavaScript benchmarks,” he says.

However, developers and users continually demand better performance. This insatiable demand combined with Mozilla’s own standards and the fact that its own application is largely and increasingly written in JavaScript, led Mozilla to develop TraceMonkey, according to Shaver.

The problem is that JavaScript is a powerful and dynamic language that until now has been implemented in a manner that is flexible but slow — in technical terms, a matter of interpretation versus compilation, explained Ray Valdes, a Gartner analyst.

These performance problems keep JavaScript from being used, Mozilla’s Eich pointed out, “or make its performance less snappy than it should be for all sorts of advanced Web apps, image processing, games, spreadsheets, word processors, etc.”

Stronger and Faster Web

“[Mozilla’s] new initiative uses an implementation technique called ‘just-in-time compilation’ that delivers significantly greater speed,” Valdes told LinuxInsider. “Other languages like Java and VB.NET have been using this technique for a while, but those languages have a design that is more conventional and easier to enhance. Applying this technique to Javascript has been a challenge until now.”

Having met the challenge with TraceMonkey, Mozilla also realized increased speed in its other applications.

“This work also speeds up Firefox and Mozilla’s other XUL (XML User Interface Language)-based applications which use JavaScript for their user interface programming,” Eich noted.

The new feature could have an impact not just on Firefox, but on the Web at large as well.

“Increasingly, modern Web sites and applications like Google Gmail have been making intensive use of JavaScript compared to years past. Gmail has about twenty times the Javascript code than the average Web page of five years ago. This has led to an increased need for an optimized version of JavaScript,” Valdes pointed out.

That said, the technology is sure to make its way into Microsoft’s Internet Explorer, Apple’s Safari and other browsers, he added.

“Once everyone sees the resulting speed improvements, users of other browsers will clamor for a similar experience, and the development teams will respond,” Valdes concluded.

Leave a Comment

Please sign in to post or reply to a comment. New users create a free account.

Related Stories

LinuxInsider Channels