Read our latest blog posts, learn something new, find answers, and stay up to date.

Site Optimization

I have been busy the past three months working on a site optimization project for a startup company where the code had been written by 10+ programmers who had come and gone over the last year. That left a big site with lots of unused and crazy CSS, images, javascript, and nasty HTML structure. I approached this project with two stages in mind:

  1. Start clean with CSS and XHTML. The first thing I did was unlink the main 5 thousand line CSS file along with a handful of others which was wreaking all kinds of havoc. I then went into every view, standardized the overall HTML structure (so it could hold it’s own without any CSS), and then only added in the CSS that was used.
  2. Maximize HTTP requests. The next phase will involve spriting images and pairing down and combining javascript so the number of HTTP requests goes way down.

The initial results:
Total HTTP Requests: 192
Total Size: 1353141 bytes

After the first stage (finished today), the general results:
Total HTTP Requests: 67
Total Size: 693064 bytes

After stage two is completed – I think I can get those numbers down by another half.

From Yahoo!:
“80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages.”

Why does all this matter? Think of a big, busy site. Think about the number of users – and then multiply that by the number of requests as well as the size of each page load. If you want good performance from your site – the pay off from optimizing your site will really pay off. It is pretty easy to go through your site and cleanup small things that over time will really add up. Not using a javascript you once did? Remove it from the header. Redid the site but still have a link to the old CSS “just in case”? Get rid of it! Remember, a little goes a long way.