PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Speeding Up Your PHP Web Site

Tools for Improving Performance

It's easy to get an idea of how your web site can be sped up using Google's Page Speed or Yahoo's YSlow. Both of these are add-ons for Firebug, the popular Firefox plug-in.

Once you have these installed, visit the site you want to improve in Firefox then analyze the page using these tools. These two tools both use similar measures, but there are differences between the two of them.

Google's Page Speed

Firstly, let's take a look at Page Speed. Once the page you want to analyze has loaded, click on the Analyze Performance button in the Page Speed panel. After a few seconds you will be presented with the results.

You will given a score out of 100, where the higher the number is the better.

Figure 2 Analyzing performance in Page Speed
Figure 2: Analyzing performance in Page Speed

While not all tests necessarily apply to your site (and some of the recommended changes may be beyond your control), there will no doubt be several suggestions that you can actually implement.

Some suggestions are aimed at speeding up network access (such as using a content delivery network or minifying JavaScript), while other suggestions will decrease rendering time (such as specifying image dimensions or using more efficient CSS selectors).

In any case, all suggestions will at least give the illusion to users that your site is quicker. This can be the difference between them staying on your site and leaving.

Yahoo!'s Yslow

Let's now take a look at Yslow. To analyze a page using this tool, load the Yslow panel and click Run Test. You can specify to automatically run this test whenever a page is loaded, but this may significantly slow down your web browsing.

Figure 3 Analyzing performance in YSlow
Figure 3: Analyzing performance in YSlow

Yslow will grade the various aspects of the site's performance, where A is good and F is bad.

Note: If you use a Content Delivery Network, Yslow won't recognise it unless you manually add it to the Yslow settings.

Just like with Page Speed, click on a topic to get more instructions on how to implement the suggestion.

Another really useful tool which is integrated directly into Yslow is the Smush.it tool. This tool will analyze all images on the current page to try and compress them more than they already are. This is a lossless tool, meaning images don't lose any quality when they are reduced.

To access Smush.it, click on the Tools tab within Yslow, or visit the Smush.it site at http://www.smushit.com/.

In This Article