Live: 300+ Best Black Friday Deals Live: Black Friday TV Deals BF Deals Under $25 BF Deals Under $50 5 BF Splurges 8 BF Must-Haves 15 Weird Amazon BF Deals BF Cheat Sheet
Want CNET to notify you of price drops and the latest stories?
No, thank you

Browser war centers on once-obscure JavaScript

All Microsoft's browser rivals are scrambling to speed up JavaScript, trying to get ahead as the Web expands into a foundation for programs.

After inconspicuously lurking within Web sites' code for more than a decade, JavaScript has emerged to become a key battleground in a second era of Web browser wars.

JavaScript, which lets developers create everything from basic Web site menus to online spreadsheet applications, was born in the mid-1990s when Microsoft's Internet Explorer challenged the incumbent browser, Netscape's Navigator. IE won that war, but now it faces its own challenge from the heir to the Navigator throne, Mozilla's Firefox, along with upstarts including Google's Chrome, Apple's Safari, and Opera.

All the challengers tout JavaScript performance as a major part of their competitive attack--even to the point of naming their JavaScript engines built into their browsers: Chrome's V8, Firefox's TraceMonkey, Opera's Futhark and upcoming Carakan, and Safari's newly branded Nitro, which is Apple's version of WebKit's Squirrelfish.

Microsoft's tests of page-loading speeds gave it the edge over Chrome and Firefox. But page-loading speed isn't everything
Microsoft's tests of page-loading speeds gave it the edge over Chrome and Firefox. But page-loading speed isn't everything Microsoft

Though IE lags all these rivals in JavaScript performance, Microsoft does care about performance overall and JavaScript performance specifically. Even as Microsoft launched a brand-new browser version, Internet Explorer 8, on Thursday, however, it's also clear the company has a big difference of opinion about the matter.

"We're going to keep making the script engines faster (but) right now it's not clear how many people are gated by script performance," said IE general manager Dean Hachamovitch in an interview. "JavaScript comprises a small portion of how fast a Web page will render. It is a piece, but by no means the holy grail."

Because it's easy to measure, JavaScript performance has "become shorthand for browser performance," Hachamovitch added. Microsoft has begun touting its new test of page-loading speeds in which IE 8 fared better overall than Firefox 3.0.5 and Chrome 1.0. A supporting slow-motion video (click "Case Study Videos, then Performance Testing) shows page-loading speeds down to the hundredth of a second.

Likely not coincidentally, though, Google offered its own propaganda the day before the IE 8 launch. Google launched its Chrome Experiments site to tout what can be done with high-performance JavaScript and to promote its browser. While Chrome generally runs sites' applications with aplomb, that isn't the case for IE.

Browsing vs. running applications
Here's what the difference between the companies boils down to: Microsoft is focusing on today's Web, and the rivals are focusing on tomorrow's.

The Internet is growing from a Web made of static pages to be read with links to be clicked into a Web that also includes applications that perform computational tasks and that people interact with. In other words, browsers now have to process data as well as load pages. Microsoft's dominant share--67 percent according to Net Applications' figures--reflects the more mainstream world, and the challengers are aiming for where they think the mainstream will be going.

"The faster we make JavaScript, the more interesting and interactive the Web becomes," said Mike Beltzner, Mozilla's director of Firefox.

Google agrees. "We saw a lot of Web developers lamenting the fact that they couldn't do what they wanted to do because JavaScript was a limiting factor," said Darin Fisher, a Chrome engineer at Google. It's certainly not the only bottleneck, but Google concluded that "by far the biggest performance opportunity we saw was to improve JavaScript."

Google has a direct interest in faster JavaScript. It's among the biggest advocates of cloud computing, in which Internet-based applications and services replace those running natively on a personal computer.

On a recent SunSpider test of JavaScript performance, IE comes in last.
On a recent SunSpider test of JavaScript performance, IE comes in last. Stephen Shankland/CNET

But Google Docs, Google Calendar, and Gmail aren't rarities. Yahoo, Facebook, and countless other sites make extensive use of JavaScript, and Microsoft itself is working to produce online versions of its Office suite.

AdventNet's Zoho division, which also offers Web-based tools for word processing, spreadsheets, and other tasks, is another company eager for faster JavaScript. Currently the company has to show a separate site with reduced abilities to people who use IE 6 with the site, said Zoho Chief Executive Sridhar Vembu.

"We're excited because this represents a fundamental breakthrough in JavaScript performance and capability for applications like ours," Vembu said of the new generation of browsers. "Within a year I think we'll see such browsers dominating the landscape."

He's also optimistic that Microsoft will close the JavaScript gap with its rivals. "I believe Microsoft will catch up," he said.

To emphasize only JavaScript for Web applications is to oversimplify the situation. (And of course there are any number of other aspects of browser quality, including security, plug-in availability, operating system support, user interface responsiveness, Web site support.) Web applications also benefit from new technology arriving Web standards including HTML (Hypertext Markup Language) 5 and CSS (Cascading Style Sheets) 3. But JavaScript provides the programming language to join all those elements into a Web site that does something, not just shows something.

"All that is mediated by JavaScript. It's really the control structure of the Web," said Mozilla's Beltzner said.

A horse race
JavaScript didn't just catch on yesterday. Its popularity has been gradually building as programmers discovered how to use it to reproduce some of the interactivity of PC-based software in Web-based applications. For example, in Yahoo Mail, people can click on a message and drag it to a folder. Collectively, this higher-end JavaScript technology is called Ajax.

Microsoft's Internet Explorer remained the dominant browser in February 2009 but challengers have secured about a third of the market.
Microsoft's Internet Explorer remained the dominant browser in February 2009 but challengers have secured about a third of the market. Net Applications

"A couple years ago, people started embracing new development models that were even more JavaScript-heavy than before," Beltzner said. "We were getting to a point where Web developers wanted to do more than the browsers could handle."

In 2008, the JavaScript engines started hogging the spotlight in browser advancement circles. In June came Squirrelfish from WebKit, then Squirrelfish Extreme in September. Firefox announced TraceMonkey in August. Google touted V8 with its release of Chrome in September. Opera in February announced its aspiration to beat them all with Carakan, and later that month Apple touted the JavaScript speed of its new Safari 4 beta version.

"It was WebKit I think that really ignited the competition," Beltzner said. "Having somebody else play along (gave us) a way of us questioning our own assumptions about whether we have done the best we can do." And Chrome is "certainly keeping the pressure on."

Microsoft defends its priorities. "We're certainly aware of what the other browsers are doing," said IE senior director Amy Barzdukas. "Browser makers need to be sensitive not just to the cutting edge but to people who use the Web."

JavaScript vs. Flash and Silverlight

Microsoft also has another answer for those who want to build elaborate Web applications: its Silverlight software, version 3 of which the company detailed Wednesday. Silverlight competes most directly with Adobe Systems' Flash, the dominant browser plug-in used to provide applications with a lot of pizzazz.

Darin Fisher of Google's Chrome project.
Darin Fisher of Google's Chrome project. Stephen Shankland/CNET

The current trajectory of JavaScript means that it's encroaching more on the turf of Silverlight, which uses Microsoft's C# programming language, and Flash, which uses a JavaScript relative called ActionScript.

"JavaScript in Chrome almost reaches the speed of Flash," said programmer Mr. Doob, who wrote Chrome Experiments called Ball Pool and Google Gravity, in a blog post about them this week.

In an interview, Mr. Doob--a Flash programmer who learned JavaScript just for the Chrome Experiments and declined to give his real name--said JavaScript is about three quarters Flash's speed. There are weaknesses, though. For one thing, he found JavaScript developer tools to be primitive. For another, JavaScript varies from one browser to the next.

"The main benefit of ActionScript is that it will look exactly the same in any browser and in any version of the browser, even on IE6! With JavaScript it depends on which features the browser supports so you would spend more time making sure the project looks good in all the browsers than actually developing the project," he said. To make his Chrome experiments work on other browsers, "I'll have to introduce some hacks which will slow down performance and will dramatically affect the user experience."

Typically, though, as programming technologies mature, they settle into standards and get more refined tools. For now, performance is the top priority--at least until JavaScript gets fast enough that other problems move to the fore.

"All it took was a little competition to get other companies focusing on this problem," Fisher said. At some point, "Suddenly this problem won't be a problem anymore and we can move on to the next issue."