Monthly Archives: February 2008

Move Javascript to the bottom of the page

Written by Eike Pierstorff

I have blogged about this before, but right now I’m happy to repeat myself: The Yahoo Developer Network has excellent advice on how to optimize load time for your web pages, and the best thing is that so much of it can be easily implemented.

Yahoos Rules for High Performance Web Sites start from the somewhat amazing observation that it’s not so much the response time of the server the time it takes the server to generate the page that slows down a web site but the things that happen after the HTML has been sent to the client.

Most relevant for my case was that a) the browser makes a new http request for each ressource (style sheet, script, image etc) in the page (and the more request the slower the page) and that with external javascript files progressive rendering is blocked for all content below the script, meaning the rest of the page will not render before the script files are downloaded. An easy workaround is to call the scripts near the page bottom (though there might be scripts where this is not possible).

I’m working on a site that uses prototype and various parts of the scriptaculous effects library, and I ended with six external javascript files. When I moved the script tags from the head section to the bottom of the page the load improved from about six seconds to two seconds (how do I know? I used Yahoos yslow to measure site performance).

Now you might say that two seconds over a DSL connection is still pretty slow. But so far I have tripled load speed and it didn’t cost me more effort than a single cut and paste action – I call that amazing.

I think most of Yahoos rules make sense only if you work on large sites with tens of thousands millions of visitors – I certainly will not set up a Content Delivery Network for a site with a few hundred visitors per day. Even so I think this proves that looking at the big boys can be a valuable excercise for us one man shops.

I any case I’ve ordered Steve Souder’s (Yahoo! performance chief) book High Performance Web Sites – I don’t know if there’s anything in it that I couldn’t find as well on the YUI-Blog, but to buy the book seems a nice way to appreciate his work.

    Now, deliver

    Written by Eike Pierstorff

    I love, love, love the International Space Station (hey, what else could I say as a science fiction fan?) but so far it has done very little except to prove – since it has not floated away into space – that gravity actually works.

    I knew that.

    But yesterday, with some 16 years delay, the european space laboratory Columbus was connected to the ISS, enhancing it’s capability for science experiments – which is where I get a bit of a problem, since for all my enthusiasm I know only in very broad terms what actual experiments Columbus is supposed to do or what’s going to happen with the results, and the coverage on the websites of ESA and DLR is hardly exhaustive. Columbus was quite expensive (well, unless you compare it with what in a country like Germany is spent on cigarettes or alcohol or simply wasted) and it feels a bit odd to be left out of the loop when, as a matter of fact, my taxes helped to pay for the loop. Now that the thing is finally in place I expect detailed reports on what experiments are done, why they are worth the effort and if and how the results are released to the public.

    Having part in a space station is all very nice but it shouldn’t be an end in itself. We’re waiting for the goods so now, deliver.

      STS-122

      Written by Eike Pierstorff

      Space shuttle Atlantis (STS 122) is scheduled to launch Thursday, Feb 7, after the mission had been repeatedly postponed due to technical problems. Atlantis will carry the Columbus laboratory to the International Space Station which will greatly (finally!) enhance the stations capability to do some actual science.

      I hope everything works out this time. I’m a bit of a space enthusiast, so it would be such a perfect birthday present for me.