2009/06/23

Some notes about yslow

Company’s webstie is slow. The boss wanted to know why and I am trying to find out why.

I think form web developer viewpoint, what you can do is optimize the web component. If your site hosted on a bad server, then you effort on optimizing the web component is minor. Anyway Firefox fox yslow seems to be a great tool helping you do the website optimization.

1. make fewer HTTP requests.

I think most of current sites have a same problem that a page contain too many external javascript scripts. yslow suggests to try combining them into one, however, most of time this is not a solution at all because you just could not combine them.

2. yslow suggest move all javascript at bottom.

If you should every javascritp snippets, which are relied to those javascripts at header, is running after document ready, then you may do this. Otherwise, you may break some of them.

3. Minify javascript and css

I do some of them. Just too lazy to do all of this, because you are going to update those minified files, that is pain. You have to edit the unminified version, test it and then minfied it again (unless you have a good eye to modify on a minified file)

4. Add expires headers and compress components with gzip

This can be done by updating apache setting …

5. Use a content delivery network

I think this is a big reason the site is slow, if you site hosted on a fast and stable content  delivery network, then you site is most likely running faster.

Note: Just found that yslow does not recognized old style JavaScript tags, like

<script language="JavaScript" src="/js/ajax.js"></script>
//yslow uses type to determine it is javascript or not
<script type="text/javascript" src="/js/ajax.js"></script>

No comments:

Post a Comment