Optimizing Web Page Load Time: Using YSlow, part 1

Jordan Sandford - August 31, 2009

In this post, I will look a little deeper into using YSlow to optimize your web pages for speed.

Let’s start off with the Grade section. Usually, when you click the Grade tab, YSlow will quickly run through a few processes and show you a gray progress bar. It is collecting information, analyzing and grading your page’s performance. YSlow shows your overall grade in the top left, and by default, it will show all 22 metrics (in some order that I haven’t figured out yet) and their grade. Click each of the six sections on the top to show only metrics in those categories (e.g., server). The Grade tab is a great way to remember some things to check in analyzing your page’s performance. Remember, though, not all 22 metrics should be taken as hard and fast rules. It often depends on the type of your site and your specific situation.

One way to quickly see what is going on with your performance is to analyze how many HTTP requests (i.e. any request for any type of file your browser makes when displaying a web page) are occurring as well as how much data is being downloaded. The Statistics tab shows a nice overview of this information with pie charts to boot. There is obviously a direct correlation between the amount of data that is downloaded to the amount of time it takes to fully display your page. The Statistics tab shows the total data amount, or “weight,” that is downloaded as well as how many HTTP requests were needed. It breaks this into two helpful categories: Empty Cache and Primed Cache. Empty cache represents the situation where you have never been to that site before and you visit the page that is being analyzed for the first time. Technically, it means that browser does not have anything the page requests already stored in temporary memory. After making those requests, it stores what requested files it can into temporary memory so that the next time it needs to request those files, it can just pull them from the temporary storage, which is many times faster than requesting it over the Internet. Primed Cache represents the scenario when your browser has at least some of the requested files already stored in memory.

Next to each of the two pie charts, YSlow displays a categorized table of items it requested and the “weight” of all items in each category. The categories are: HTML/Text, JavaScript File, Stylesheet File, CSS Image, Image and Favicon. If either your empty or primed cache shows more than one request for a CSS image, these images may be good candidates for CSS image sprites. Image sprites is a technique used to reduce the amount of HTTP Requests by putting all multiple images in one larger image (like a pasteboard) and using the CSS background-position rule to only show the appropriate image at the appropriate area of your web page layout. How practical this may be depends on whether any of the images reside on other servers and whether any of them are 8-bit (256 color) images. If the files exist on other servers, you should ask yourself if you should combine them. One reason you may not combine them, even all images are full-color is that the image is often updated by some other website that resides on that 3rd party server.

Use similar logic for determining if you should combine the Javascript and Stylesheet files that your site uses. To be able to combine the files, you’ll have to know which files to combine. That is where the Components tab comes into play. I’ll cover that section in my next post. Until then, enjoy your break.

© 2024 MoreVisibility. All rights reserved.