13 April 2010

Speeding up my site

Last weekend I made a few performance changes to my site—I was inspired by the announcement by Google that they are using site speed in rankings. My site was already in decent shape: only a few images, no javascript packages, not a whole lot of css, and google analytics at the bottom of the file, however, Google webmaster tools was claiming that my pages took on avaerage 3.3 seconds to load and that this was slower than 55% of sites on the web—surely I can do better? So, I started by removing a widget from my sidebar and then made the following changes…

Google Analytics - Asynchronous Tracking

The asynchronous tracking makes Google analytics load asynchronously on the page if you’re using pretty much any browser other than Opera or Firefox before 3.6, and it is just as easy to use as the regular GA snippets. This is really excellent for any site that uses GA, since it will prevent the case where tracking scripts can block page loads.

Minified CSS file

I am now putting all of my CSS into one file (I had my CSS for code highlighting in a separate one before) and I am using the YUI minifier to minify it. Not a huge difference, but it’s a nice thing to do.

Blog Post Excerpts

If you view my home page and scroll down, you’ll see that I still show full blog posts for the two most recent posts, but after that I show “excerpts.” This means there’s less stuff to download, and it means that there’s less duplicate content on my site. For each blog post, I write a custom meta description blurb, and I am just using those as my “excerpts”—now you know why I used quotes above.

Next steps

I plan on settings caching headers for my static content and I’d also like to use memcached with my django install to cache the SQL queries for the blog posts as well as some of the more static pages that django is serving. I’ll have to add a hook in my admin interface to make the cache write-through, so I can cache the posts for a long time.

I could also get a faster, non-shared web hosting service, but WebFaction is working well enough, is configurable enough, and is cheap enough to keep me happy.

Update 4/14/10 - funny enough, the webmaster tools “Site Performance” data just updated this morning for my site, and it’s now saying that my pages take 1.0 second to load and are faster than 90% of sites on the web. Of course this measurement and the prior measurement are what they call “low accuracy estimates” since I don’t get a huge amount of traffic, but still a nice change to see.

Did you find this helpful or fun? paypal.me/mrcoles
comments powered by Disqus

Peter Coles

Peter Coles

is a software engineer living in NYC who is building Superset 💪 and also created GoFullPage 📸
more »

github · soundcloud · @lethys · rss