Articles Comments

Marco Luthe Online! » WordPress Stuff » Compressing Files To Speed Up Your Site

Compressing Files To Speed Up Your Site

As I have posted some time ago, I was not quite pleased with the speed of my blog’s loading process.

Now, I have found some ways after analysing the site with YSlow.

  1. As of WordPress 2.5, GZIP compression can no longer be activated in the settings, which means you have to do it on your own. You can either use Il Filosofo’s WordPress plugin GZIP Pages – or you can put the following code into your .htaccess-file (which must be supported, of course):
    # Enable GZIP compression
    php_flag zlib.output_compression on
    php_value zlib.output_compression_level 2
  2. Done with 1., I found out that JS/CSS files were not gzipped. As the prototype javascript library is the largest JS file in WP 2.6, I compressed (shrunk) it with Yahoo’s YUI Compressor, which went very well – I haven’t found any errors using the compressed (shrunk) version so far.

    Using the YUI Compressor on /wp-includes/js/prototype.js lead to a file that is now 40% smaller (71k instead of 122k).

  3. Although shrinking prototype helped speeding up, I still found the the JS/CSS files un-gzipped, until I stumbled upon this nice article and this one which suggest to put the following code into your .htaccess (your server must support mod_deflate):
    # GZIP files
    <IfModule mod_deflate.c>
    <FilesMatch "\.(js|css|html|htm|php|xml)$">
    SetOutputFilter DEFLATE
  4. The Digg JS was loaded with every post, which ended up loading the same Javascript 5 times (5 posts per page). So I banned the Digg button to show up on the single post page only.
  5. Last not least, I got rid of the MyBlogLog tracking code and the click tagging code, because I use Google Analytics, which should be sufficient.

The next tasks will be to get rid of unused CSS elements, shrink some more CSS/JS files, remove annoying sidebar boxes – and finally, a cleanup of the whole template code.

[Update from 2008-10-10]

OK, I admit, I am kind of stupid sometimes: with every WordPress update, I lose the packed prototype file, because I delete wp-includes completely. So, as a reminder: WITH EACH WP UPDATE, PACK PROTOTYPE AGAIN! This is safer than putting in the formerly packed prototype.js every time, because you never know what might have been changed. Hope I will remember… :-)

[Update from 2009-04-23]

The PHP Speedy WordPress Plugin also helps to speed up your site by joining JS- and CSS-files into one single file each (i.e. one JS-file and one CSS-file instead of maybe a dozen).

Filed under: WordPress Stuff · Tags: , , , , , , , , , , , , , , , , , , , ,

  • AskApache

    That digg issue bothered me for a long time too.. so did having an external google-analytics javascript, and other miniscule things like how google-analytics by default sets cookies that are sent for any subdomain on the server, for every request.

    I’ve fixed all those issues, and am in the process of writing it all down now.. My site is F-A-S-T! Check the yslow/source/speed of my home-page:

  • Kyn

    You can load in your header the google hosted “prototype.js” here,, which would save you from having to load your own.

  • Marco

    The question is:
    How do I tell WordPress to not load the built-in one?

blog comments powered by Disqus