Friday, October 26, 2007

Speed Up Your Web Page

When you try to improve the speed of your Web page, you must consider several things:

  • Images
    Optimizing your images is the best way to improve the download speed of your Web pages. A good rule of thumb is to strive for no one image being larger than 10 Kb. This is especially hard with animations, but if you can do it, you'll have some great fast images.

    Also, after you optimize your images, you should call them in your HTML with the height and width specified in the image tag. This will allow the browser to continue rendering the Web page while the image downloads in the background.
  • HTML
    Once you have your images down to a reasonable size, try streamlining your HTML. You will find sites out on the Internet that advocate removing all extraneous tags, to the point of removing the final and . I do not think this is a good idea, but you can remove all the unnecessary attributes created by some editors, and use the defaults of tags as much as possible. For example, if you create a table and you want the cellpadding and cellspacing to be 2, then leave out those attributes. That is the default for a table.
  • Page size
    With small images and clean HTML, you can still end up with a page that takes forever to download because there is so much information. If you are striving for a speedy download, limit your page total size (including images) to about 30 Kb. You'll still be on the high side if you're at 30 Kb, but 50% of the pages on the Web are 32 Kb or less, so you'll be in good company. (From the Seventh Georgia Tech GVU WWW survey as quoted in "How Much is Too Much")
  • Tables
    Nested tables are a common cause of slow pages. They are so tempting to use as they improve the layout enormously, but they take a long time for the browser to render. It's not that the page didn't download, but with multiple tables in tables, the browser has to work harder to display the page. It cannot display any part of the page in the tables until it has figured out how to render all the tables that are nested.
  • Advertisements
    Many advertisements are served from a different Web server than the Web page. If that server is down or slow, it will impact the loading of any page they are called from. The same is true for counters and other external CGIs and images that are not on the same Web server.
  • Web Server
    If you've optimized your graphics and HTML and kept the page size to a minimum and it still takes forever to load, check out your Web server. Is it getting more hits than it can handle? It might be time to upgrade the machine or the connection between it and the world, if it isn't showing the bandwidth you want.

1 comment:

Jennifer Kyrnin said...

It has come to my attention that the content I wrote for About.com is currently on your site. Specifically, the article on
http://webexpertsonline.blogspot.com/2007/10/speed-up-your-web-page.html
is a copy of my article posted here:
http://webdesign.about.com/od/speed/a/aa110998.htm

I'd appreciate it if you'd please remove this content. It's copyrighted material. If you're interested in purchasing my content for your site/magazine, etc. please contact About.com at http://advertise.about.com/reprint.html. Someone from the NYTimes will be happy to discuss the purchase of the content.

I appreciate your prompt attention. If this content is not removed within 7 days I will contact the Blogger Legal department.

Thank you,
Jennifer Kyrnin