Andy Hopper: Computing for the Future of the Planet
I recently hosted Andy Hopper (University of Cambridge) at Google to deliver his talk on Computing for the Future of the Planet (YouTube video). He covered a variety of areas that ranged from practical deployment issues that should be addressed today to futuristic concepts. The beginning of the talk, the part that was of most interest to me, was about energy efficient computing: adaptive datacentres and a “virtual battery” (moving computing tasks to where energy is available). Power consumption is certainly a key focus for Google and other large web companies. It’s intriguing to think about shifting data and processes in real time based on the cost of energy.
Google AJAX Libraries API
Today Dion Almaer announced the Google AJAX Libraries API. This is a great resource for developers using any of the popular JavaScript frameworks including Prototype, Script.aculo.us, jQuery, Dojo, and MooTools. Rather than downloading it to your own server and hosting it from there, you can request your preferred JavaScript library from ajax.googleapis.com
:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js">
</script>
The greatest benefit in my opinion is that any developer can leverage Google’s CDN to deliver the bulk of their JavaScript. From YSlow and my book I received a lot of feedback that Rule 2: Use a CDN was out of reach for many developers. I use jQuery in one of my personal projects and serve it on my hosted web site from one geographic location. Ouch. Being able to move that 21K closer to my users is great.
Splitting the Initial Payload
This post is based on a chapter from Even Faster Web Sites, the follow-up to High Performance Web Sites. Posts in this series include: chapters and contributing authors, Splitting the Initial Payload, Loading Scripts Without Blocking, Coupling Asynchronous Scripts, Positioning Inline Scripts, Sharding Dominant Domains, Flushing the Document Early, Using Iframes Sparingly, and Simplifying CSS Selectors.
The growing adoption of Ajax and DHTML means today’s web pages have more JavaScript than ever before. The average top ten U.S. web site[1] contains 252K of JavaScript. JavaScript slows pages down. When the browser starts downloading or executing JavaScript it won’t start any other parallel downloads. Also, anything below an external script is not rendered until the script is completely downloaded and executed. Even in the case where external scripts are cached the execution time can still slow down the user experience and thwart progressive rendering.
Every line of JavaScript code matters to a fast loading page. And yet, as shown in Table 1, the average top ten U.S. web site only executes 25% of the JavaScript functionality before the onload event.[2] Why track this relative to the onload event? Any code needed after the onload event (for dropdown menus, Ajax requests, etc.) could be downloaded later, making the initial page render more quickly.
High Performance Web Sites, Part 2
In my first book, High Performance Web Sites, I presented 14 rules for making web pages faster. I’ve got some good news and some bad news. Bad news first: there are more than 14 things you have to do to speed up your pages. The good news is I’ve started another book that describes more best practices for web performance. The working title is High Performance Web Sites, Part 2. Here’s the set of rules I have so far:
- Split the initial payload
- Load scripts without blocking
- Don’t scatter scripts
- Split dominant content domains
- Make static content cookie-free
- Reduce cookie weight
- Minify CSS
- Optimize images
- Use iframes sparingly
- To www or not to www
Cuzillion
At Web 2.0 Expo today I announce the release of Cuzillion. The tag line is ‘cuz there are zillion pages to check. It’s indispensable for people like me who are always pushing browsers to their limit trying to figure out how to squeeze out a little more performance.
I’m constantly thinking of or being asked about how browsers handle different sets of resources loaded in various ways. Before I would open an editor and build some test pages. Firing up a packet sniffer I would load these pages in different browsers to diagnose what was going on. I was starting my research on advanced techniques for loading scripts without blocking and realized the number of test pages needed to cover all the permutations was in the hundreds. That was the birth of Cuzillion. (more…)
O’Reilly Webcast
This Thursday, April 24, at 10am PDT I’m doing a webcast entitled “Even Faster Web Sites”. This is a new type of event for O’Reilly and I’m excited to try it out. I’ll do 30 minutes of talking with online slides and demos, followed by questions from listeners. There is a limit to the number of people who can attend, so please register in advance.
Web 2.0 Expo
I’ll be speaking at Web 2.0 Expo in San Francisco April 25 at 1:30pm. My talk is called Even Faster Web Sites. This is my next set of performance best practices including how to load scripts without blocking and the dangers of inline scripts. If you’re thinking of coming please the discount code “websf08sbg” to save an extra 10%.
Roundup on Parallel Connections
A lot of blogging and follow-up discussion ensued with the announcement that IE8 supports six connections per host. The blogs I saw:
- IE8: The Performance Implications
- IE8 speeds things up
- IE8: 6 Connections Per Host
- IE 8 and Performance
- Testing IE8.s Connection Parallelism
- IE 8 Connection Parallelism Issues
It’s likely that Firefox 3 will support 6 connections per server in an upcoming beta release, which means more discussion is expected. I wanted to pull all the facts into one place and make several points that I think are important and interesting. Specifically I talk about:
- the HTTP/1.1 RFC
- settings for current browsers
- upperbound of open connections (cool!)
- effect of proxies
- will this break the Internet?
Purple Hippo at SXSW
Fluff piece: I was at SXSW Interactive this past weekend. Just like that AT&T commercial, my youngest daughter (5 years old) snuck her purple hippo into my suitcase. It’s always hard leaving my girls behind. Emailing photos back via my iPhone made the trip easier for them and me.
Most of the action was on the 4th floor of the convention center, so everyday started with a long escalator ride. This was my first year at SXSW, but several veterans mentioned how sessions were spread out more than usual. Several times I saw Freddy Wong, the US Guitar Hero 3 Champion, rocking out. Purple hippo wanted some of that action.
IE8 speeds things up
IE8 Beta 1 has several performance improvements listed in the release notes. Many of these improvements center around the DOM and JavaScript execution. And their announcement about stricter standards compliance is a great move forward. There are three changes that are big and relate to my performance best practices: 6 downloads per hostname, loading scripts in parallel (the biggest improvement!), and support for data: URIs.