How are the two browsers different, and how are they the same?

To understand why two major browsers are competing for the same space, it's important to see how they differ.

The most cited reason for Chrome being chosen over Firefox is its speed. Since its release, it's not an exaggeration to say that Chrome has changed most users' expectations of how fast a browser can feel.

This is, in part, because websites are becoming a lot more complicated, filling every available crevice with advanced features, and because most other web browsers pre-date the web 2.0 revolution that's taken so many of our desktop-bound applications into the cloud.

Sunspider

Realising that most of this online interaction was through JavaScript, the Chrome development team went all-out to make its JavaScript performance revolutionary. In doing so, they upgraded the user experience for every site based on JavaScript code.

Google obviously had a vested interest – many of its own feature-rich cloud applications rely heavily on the language to provide functionality. But then, so does the rest of the web. There's hardly a site left that doesn't add some usability logic through a few lines of JavaScript code.

The first version of Chrome caused a storm when it was revealed to be almost twice as fast as Firefox 3.0.1 in the SunSpider JavaScript benchmark, and 35 times faster than Internet Explorer 7.

This was all thanks to its V8 JavaScript engine, and while benchmarks are always contentious because they place unrealistic loads on browsers, most people could feel the difference when they used Chrome. SunSpider is an interesting attempt to mimic many different real-world scenarios, including decompression, encryption, general mathematics and sting handling.

Firefox developers responded with their own JavaScript optimisations, woven into a new engine called TraceMonkey. This added something called Trace Trees to the original SpiderMonkey engine, and improved performance by looking through the code for common paths, which were then precompiled.

V8, in comparison, attempts to pre-compile as much as possible by turning JavaScript into machine code rather than byte code when it's first executed, and handles the dynamic nature of JavaScript by patching the inline code through its runtime system. It's complicated, but the results speak for themselves.

We ran Firefox 3.6.3 and Chrome 5.0.370 against each other with SunSpider 0.9, and the gap between them has grown. Firefox completed the tests in 1,475.1ms , while Chrome took just 444.5ms – almost three times faster than the speed it attained on its debut.

However, Firefox also peformed much better than the original Chrome, which shows that users of both browsers have benefited from the competition to build a screaming JavaScript engine. They're both promising improvements for the future.

Desktop integration

Firefox is deeply ingrained with Linux sensibilities, and we often consider the project to be one of our own; one of the flagships we're proud to herald as an example of what open source can achieve.

As a result, there's never been any hesitation when it comes to including it as a default browser in all but the most ardent KDE-based distributions. This is because Firefox is built using GTK, the same programmers' toolkit used to create Gnome.

As a result, it can feel more integrated within the Gnome environment. Toolbars, menus, file requesters and themes will look the same without any modification. From KDE, the alterations that make Firefox look like a KDE application are purely cosmetic, and can feel a little rough around the edges. But not as rough as Chrome can sometimes seem.

Chrome

As Chrome developer Ben Goodger explained, Google avoided cross-platform toolkits because applications that use them end up "speaking with a foreign accent". Instead, they used GTK for the user-interface. This is slightly ironic considering Goodger was the the lead developer for Firefox before taking to the helm of the Chrome project, but what he says makes sense.

Without the long-standing tradition of Linux use, Chrome's use of GTK has been able to forgo Gnome integration and strike out on its own. As a result, the final application looks different to both Gnome and KDE, and consequently alienates neither.

The theming engine is more adaptable to the look and feel of Gnome, reflected as one of the default theme choices, but Chrome can be coerced into a wide range of skins. Most noticeable, however, is the lack of top title bar. This is because Chrome has repositioned page tabs to the top of the window to make better use of the available real estate.

The top title bar usually gives you responsibility over your desktop's window manager, the part that controls where the windows go and how their borders are drawn. Chrome usurps the window manager by hiding it and pushing its own UI to the edge of the borderless window. This is why the browser's windows behave slightly differently to those of your native desktop and why, especially when compositing is enabled, it can be less stable than Firefox.

Linux versions of Chrome provide the option to re-instate the window border by selecting Use System Bar and Borders from the right-click menu that appears in the space after the tab view.

Security and stability

The most important feature for a browser is one that users don't see: security. A typical browser session might shuttle email, messages, banking and purchasing information, music, photos… all of which could be at risk if a leak springs up.

This is where open source really shines, with both Firefox and Chrome offering up their sources for scrutiny. As a result, they harbour very few surprises. But it's impossible to build perfection into so many lines of code, and both browsers will need updating as and when problems are discovered.

Firefox takes a wonderfully open approach to security by publishing a list of vulnerabilities, coloured according to their severity. In the first four months of this year, there were 25, of which 13 were judged critical. There's even a security blog which often responds to users' concerns and media reports.

Internet explorer 8

The Chromium security portal isn't quite as open, and you'll need to delve into the security forums to discover what's going on. This reflects a desire to keep vulnerabilities discreet, not one to hide what could be serious security risks.

The last stable update, released at the beginning of June, fixed nine serious vulnerabilities and two problems judged as medium risk, although most of these issues occurred within WebKit rather than the wider Chrome application.

There are also signs that both Mozilla and Google's development teams are happy to work together. It was Mozilla that discovered an important bug in Chrome's V8 engine, for example – no doubt in their quest to speed up their own JavaScript engine. And both projects offer bug-hunting incentives. Google and Mozilla offer $500 for every new security problem discovered, although Mozilla has a slight advantage: you also get a T-shirt.

Threads

When problems do slip through, it's Chrome's ability to shield other pages you have open that's won it supporters. If you have 10 tabs open in Firefox and you open a new page with a broken Flash animation, you lose everything. In Chrome, only the current tab stops responding.

This feature owes itself to Chrome's multi-process abilities, with which it keeps each tab running in an isolated process known as a sandbox. If something crashes within a sandbox, it doesn't affect the entire application. Instead, the tab view will be replaced with an 'Aw snap' message, and you can reload the page or give up.

This approach also has a positive effect on security, as it's almost impossible for a process running within a sandbox to access ones running within other sandboxes. When even Microsoft's Internet Explorer 8 includes window sandboxing, you may think Firefox had long ago assimilated one of Chrome's best features. But it hasn't, and currently has no plans to do so.

The best Firefox can manage is an offer to re-open the tabs you were using when you relaunch a crashed application. It does have its own 'sandbox' project, but it's the peer-review process, which has been running for more than three years, that ensures quality in add-ons installed through the official site.

However, there is some good news. With the release of Firefox 3.6.4, a version of the browser that was destined to be 3.7, plugins now run within their own processes, as they do in Chrome. This removes one of the most common causes for an application-wide crash, but it doesn't stretch to web pages and won't help you with a poorly written Flash application.

Embedded media

Listening to music and watching videos have become essential functions of your web browser. There are now many paid-for portals that let you stream movies, and many more for music.

Before HTML 5, a browser would be expected to launch an external application in such instances, spawning products such as RealPlayer. But HTML 5's specification embeds this ability in the rendering layer.

Embedded media

Firefox has been at the forefront of this revolution, embracing free formats such as Ogg Vorbis and Theora. You only need to click on an Ogg Vorbis music file, for example, and it will be embedded within a new window and played back automatically. Click on an MP3 file, by comparison, and Firefox will go back to asking which external application you'd like to use to open it.

This is a feature that's going to become increasingly important, with sites like Vimeo and YouTube already making the move away from Flash to HTML 5. But it's also going to be a particularly tough challenge for Firefox. As Mike Shaver, VP of Engineering at Mozilla puts it, "this is an important step in making video a first-class citizen of the modern web".

He then goes on to describe the specific problem facing Firefox in a future dominated by patent-encumbered codecs like the ones used by YouTube and Vimeo – H.264.

"For Mozilla, H.264 is not currently a suitable technology choice. In many countries, it is a patented technology, meaning that it is illegal to use without paying licence fees to the MPEG-LA. Without such a licence, it is not legal to use or distribute software that produces or consumes H.264- encoded content. Indeed, even distributing H.264 content over the internet or broadcasting it over the airwaves requires the consent of the MPEG-LA, and the current fee exemption for free-to-the-viewer internet delivery is only in effect until the end of 2010." [This has since been extended to 2016.]

The solution is to use a truly open format, and that means either Google's WebM or the often-criticised Ogg Theora. WebM seems to have momentum, with Chrome, Firefox and IE9 pledging support, but will it grow into a position where H.264 support becomes a non-issue?

Regardless, WebM is going to be a big part of Firefox 4, and Mozilla hacker Robert O'Callahan announced its inclusion after Google gave WebM a new licence to remove ambiguity and decouple copyright patents in the licence's language.

If WebM happens, Firefox will be in the best-possible position. If not, Linux users will still have to rely on additional packages to online content. But it's also a chance for greater collaboration.

As Michael Shaver wrote recently: "I very much believe that Google (both the Chrome and YouTube teams), Vimeo and many others share our desire to have a web with full-featured, high-performance, unencumbered, natively-integrated video, and I very much look forward to us all working – together and separately – towards that end."

Killer feature

Despite all this talk of function and the future, there's one aspect of Firefox that Chrome can't compete with: freedom. It's this that's likely to be a foundation of Mozilla's future growth.

There's little doubt that Google developed Chrome to satisfy its own agenda. With its own operating system just around the corner and a serious foothold in the mobile market, it needed its own portal to the online world, one that could present Google's applications and tools in the best light.

Firefox doesn't have those restraints. It's a browser that's been developed to bring the web to as many people as possible. As stated on its own web page, Firefox has a mission to "promote openness, innovation and opportunity on the web". This means it should always put users first, no matter what temptations are placed at its feet.

While Chrome is based on open source, it's a long way from being as open as Firefox. Mitchell Baker, Chair of the Mozilla Foundation, said it best at the end of April, when she discovered a botanical garden she was interested in seeing wasn't a tourist honeypot but a non-profit organisation like Mozilla.

"Non-profit organisations can make mistakes. They can be boring and ineffective just like anything else. But the chance that the whole thing was just something dumb designed to get people there to extract money felt much, much lower." It's the same for Mozilla.