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.
- 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
- 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).
- Although shrinking prototype helped speeding up, I still found the the JS/CSS files un-gzipped, until I stumbled upon this nice article which suggests to put the following code into your .htaccess (your server must support mod_deflate):
# Deflate js and css files <IfModule mod_deflate.c> <FilesMatch "\.(js|css)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule>
- 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.
- 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… ![]()
The post ends here. Wanna leave a response? Have Your Say!
BTW: This post has comments.
Next post: Welcome To FriendFeed And LinkedIn!
Previous post: Postcard Of Waake From 1955
The above post was initially scribbled on August 28th, 2008 @ 22:28:51 +0200 (CEST) and has been last modified on October 10th, 2008. It is filed under the category WordPress Stuff and has been tagged with the terms [.htaccess | apache | cleanup | code | compress | compression | compressor | css | deflate | file | gzip | javascript | mod_deflate | plugin | prototype | script | speed | stylesheet | wordpress | yslow | yui].
Trackback URI | Comments RSS | Permalink




Comment
#1
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: http://www.askapache.com/
AskApache recently posted: Removing Category Base from WordPress URLs