JavaScript - the Web site performance killer, Google guru says

The scripting language is one of several culprits that slow Web site loading

Nowadays, even regular Web surfers know some of the things to avoid when designing a Web site for fast performance. Cut the number of requests to the Web server. Shrink JPEG sizes. Employ a content delivery network vendor like Akamai Technologies Inc. or Limelight Networks Inc.

Problem is, according to Steve Souders, steps like these aimed at optimizing the Web server make only a tiny impact.

"We used to tear apart the Apache [Web server] code to figure out what Yahoo was doing," said Souders, who was Yahoo Inc.'s chief performance engineer for several years before moving to Google Inc. in the same role.

But after performing a detailed analysis, Souders discovered something startling: Only 10% to 20% of the time it took to load a Web site could be attributed to the Web server.

The vast majority was the result of code executing inside the Web browser, said Souders at a talk on Tuesday at Microsoft Corp.'s Tech Ed conference in Los Angeles (download PowerPoint here)

In today's Ajax-heavy Web sites, the offending code is usually JavaScript, Souders said. That's not because JavaScript files on a Web page are large, they aren't, he said, but because of the way Web browsers treat JavaScript.

"The first generation of Web browsers decided that because they had to execute all of the JavaScript files in order, we might as well execute one while stopping all other downloads," he said, as well as preventing any other code from being executed or rendered.

That may have made sense a decade ago, but in today's era of PCs powered by dual and quad-core CPUs, it doesn't. And the cost of the delays created can be high.

Google has found that a 500-millisecond delay results in a 20% decrease in Web traffic, while Amazon.com has seen a 100 millisecond delay cutting its sales by 1%, Souders said.

Better browsers, better performance

New and upcoming Web browsers will be able to download JavaScript files while executing them. Internet Explorer 8, released last month, has this feature, Souders said, as do the upcoming Firefox 3.5 from Mozilla Corp. and Chrome 2.0 from Google Inc..

Barring an overhaul of the JavaScript, the boost will stay small, Souders said.

To fix, Souders first recommends a free tool he created called Yslow that analyzes and then grades how well a Web page is designed for maximum speed. Originally developed for Internet Explorer, Yslow 2.0 is an add-on for Firefox integrated with the Firebug Web development tool. It is downloadable here.

Using YSlow, users can see how much JavaScript is being loaded in the beginning, creating a bottleneck. Users can then split the JavaScript files, loading only the necessary JavaScript at the start and leaving the rest at the end after the words and images are already up, he said.

Doing so helped one Google site that Souders declined to name speed up its initial page rendering by 60%.

Besides JavaScript files, Cascading Style Sheets (CSS) can also drag down site performance. CSS files, which describe a Web page's look and feel, have become more elaborate in recent years.

Also, users tend to stay on certain sites, such as their Web mail, all day. These sites will re-render constantly throughout the day, incurring a delay from over-elaborate CSS files each time, Souders said.

Besides JavaScript and CSS, Yslow analyzes 22 criteria in all. It is unsparing in its ranking. Popular Web sites such as Apple.com, ESPN.com and Wikipedia, received a "C" from Yslow, while NYT.com, NBA.com, and Computerworld.com earned an even worse "E."

"When I look at it, I feel like the teacher who hands out very severe grades," he said. Search engines with minimal content on the page, such as Google.com and Microsoft's Live.com, are among the rare sites that get an A from Yslow.

There are other tools besides Yslow for diagnosing performance bottlenecks. Microsoft offers the Visual Roundtrip Organizer, while AOL developed a now-open-source tool called PageTest.

All these tools judge Web site performance by a set of rules, though none of them matches YSlow's 22 criteria.

Join the PC World newsletter!

Error: Please check your email address.

Tags limelightakamaiYahooajaxGoogleMicrosoftjavascript

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Eric Lai

Computerworld
Show Comments

Essentials

Lexar® JumpDrive® S57 USB 3.0 flash drive

Learn more >

Microsoft L5V-00027 Sculpt Ergonomic Keyboard Desktop

Learn more >

Mobile

Lexar® JumpDrive® S45 USB 3.0 flash drive 

Learn more >

Exec

HD Pan/Tilt Wi-Fi Camera with Night Vision NC450

Learn more >

Lexar® JumpDrive® C20c USB Type-C flash drive 

Learn more >

Lexar® Professional 1800x microSDHC™/microSDXC™ UHS-II cards 

Learn more >

Audio-Technica ATH-ANC70 Noise Cancelling Headphones

Learn more >

Budget

Back To Business Guide

Click for more ›

Most Popular Reviews

Latest News Articles

Resources

PCW Evaluation Team

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre x360

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga 910

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?