CNET también está disponible en español.

Ir a español

Don't show this again


Elements of Firefox overhaul arrive for testing

With a name like JaegerMonkey, how can Mozilla's upcoming JavaScript engine not vanquish rivals? Also: developments with extensions and hardware acceleration.

Mozilla, faced with new competitive pressures, has begun work on three separate, significant changes to Firefox.

First is a new JavaScript engine that--with a transfusion from the project behind Apple's Safari--should run Web-based programs at least 30 percent faster. Second is a new graphics engine for Windows that will take advantage of hardware acceleration for graphics and text. And third is a programming tool to help bring to fruition a new system for Firefox add-ons.

Mozilla made notable gains against the dominant Internet Explorer since Firefox's launch five years ago, but for much of that time, Microsoft's browser barely budged. Now Google's Chrome has burst onto the scene, Apple is marketing Safari for Windows as well as Mac OS X, Opera development is moving fast, and, potentially most significantly, Microsoft is showing signs of serious interest in rejuvenating IE.

Firefox could use a shot in the arm, too. Its share of global browser usage crested in November at 24.7 percent, according to Net Applications, and has slid to 24.2 percent according to preliminary statistics for February released Monday. In that same period, Chrome grew from 3.9 percent to 5.6 percent.

Mozilla has made several significant changes to Firefox in the past year, bringing an array of new features into versions 3.5 and 3.6 and working on a "Lorentz" update designed to reduce crashes stemming from plug-ins such as Adobe Systems' Flash Player. Now a new generation of ideas, although still in rough form, are moving toward real-world use.

JavaScript overhaul
Mozilla deserves some credit for getting the race for faster JavaScript into higher gear, and its TraceMonkey engine was competitive in its time. But it's been surpassed by Chrome's V8 and Safari's Nitro, while the new Carakan engine in Opera 10.5 beta has the potential to match and perhaps beat all the contenders.

All this is important because JavaScript accounts for ever-larger amounts of browser processing. Web pages feature increasingly sophisticated user interfaces largely written in JavaScript. And new standards let browsers perform background processing tasks as well, opening the door for even more advanced Web pages and Web applications.

Thus was born a Mozilla project called JaegerMonkey.

Mozilla programmers concluded that Firefox's JavaScript engine could speed up code by converting some frequently used tasks into high-speed software compiled to run in a processor's native language rather than interpreting the higher-level JavaScript instructions. The problem was when this tracing process wouldn't kick in or was thrown off, JaegerMonkey programmer David Anderson said in a blog post Friday.

"What we've found is that when tracing works, we're faster than the generic approach. But when tracing fails, we have to fall back to our old-school interpreter. At that point your JavaScript runs about as fast as it would in 2007-2008 (i.e. before Firefox 3.5, Safari 4, Chrome, etc)," Anderson said. "That's not acceptable, and we need to fix that."

JaegerMonkey is designed to get the best of both worlds. "Why couldn't we trace and keep going super awesome fast, and when tracing fails, fall back to still really fast?" he asked. "Our new project, JaegerMonkey (or JägerMonkey), has exactly this in mind...We've barely started and the results are already really promising."

According to JaegerMonkey programmer David Mandelin's description, Mozilla decided to build on the Nitro JavaScript engine for the new elements.

"We decided to import the assembler from Apple's open-source Nitro JavaScript JIT [just-in-time compiler]," Mandelin said in the blog. "We know it's simple and fast from looking at it before (I did measurements that showed it was very fast at compiling regular expressions), it's open-source, and it's well-designed C++, so it was a great fit."

Tests with the SunSpider JavaScript benchmark show JaegerMonkey to be significantly faster. With the Nitro infusion, but no optimization work yet, Anderson's test show a 30 percent speedup on 32-bit x86 systems, and a 45 percent speedup on 64-bit x86 systems, Anderson said.

However, JaegerMonkey is still a couple steps away even from mainstream beta testing. The source code can be downloaded, but it's not yet built into Mozilla's nightly "Minefield" build of the Firefox prototype.

Direct2D acceleration
Another significant Mozilla change, support for Microsoft's Direct2D technology for accelerated text and graphics, is now in that nightly build. This means it will see much heavier real-world testing, even though it's still not in an official beta.

The Direct2D and related DirectWrite interfaces tap into computers' graphics processing chips for handling many display tasks in Windows Vista and Windows 7. One change is that typeface antialiasing, which smooths curves to get rid of jagged, pixilated edges of font characters, operates over two dimensions instead of just one with earlier technology.

"The fonts look really great with DirectWrite enabled. Really great," said Mozilla's Asa Dotzler, describing his results in a blog post Saturday.

Not a lot is known about Internet Explorer 9, currently under development, but Direct2D support is definitely a feature. In a Microsoft IE9 demonstration in 2009, the browser prototype showed dramatic speed improvement in some graphics chores such as panning around online maps.

Mozilla's ambition is to beat Microsoft to the party with Direct2D support, but the technology change is significant.

"Some extensions like Stylish and AdBlock Plus may break the new features," Dotzler cautioned. And Direct2D is not enabled by default; Dotzler supplies instructions for those keen on trying it out.

JetPack SDK
Another change coming to Firefox is a new extensions foundation called Jetpack. Mozilla hopes the new system will be easier for programmers to use and less disruptive for Firefox users to manage--no reboots are required to install or update the add-ons, for example.

But the present JetPack prototype still requires some programming chops to use. Now Mozilla is trying to ease that difficulty through release of a software development kit (SDK).

"We've just released the first release candidate of the Jetpack SDK 0.1," Jetpack team member Atul Varma said in a mailing list announcement Saturday. It's still very rough, though.

"Right now, this SDK is for people who know how to use a command-line shell, as the development tools are only usable from there." Varma said. "We're also working on a Web-based development environment called FlightDeck that will make it even easier to collaborate and build real Firefox extensions...but that's not ready quite yet."

JetPack is conceptually similar to Chrome's Web-technology extensions system, but Chrome's has just arrived for Windows and, in beta form, for Mac OS X and Linux. Mozilla, though, has just released a final JetPack prototype plug-in, version 0.8, and now is working on preparing a different package called JetPack Reboot that's intended to be actually built in to Firefox.

Add-ons are an important advantage for Firefox. Programmers over the years have build thousands of them for various tasks, letting people with a particular need customize the browser without bogging it down for others who don't want that feature. Mozilla also is working on making the current add-on foundation, called XUL, work without needing browser restarts.

Individually, each of the three elements is notable but probably not enough to significantly improve Firefox's fortunes. Collectively, they show Mozilla isn't complacent and is committed to keeping Firefox competitive.