Design is important to a blog. Most specifically, font choices. If content is king, then making it easy to read is critical. So what is better, serif or sans serif? Well, Alex Poole attempts to answer this question [Read more…]
So call me picky, but I went ahead and tried to further optimize the process for using the W3C validation buttons. I know that seems like trying to eek out another 10 horsepower from a 400 horsepower sports car, but it really bothers me to reduce efficiency for something so useless (which brings up the point, “Why use them at all?” but that’s another story).
I felt that I could probably create some efficiencies by combining the images and using an imagemap for the links instead of using two separate images. There are basically three potential areas then for optimization:
- size of the html on the page
- size of the single image vs. two seperate
- reducing the images requested from 2 to 1
Note that this whole process is only an option if you actually have both valid XHTML and CSS. If either of these don’t validate, you need to just use the one image for the one that does validate.
Ok, so here is what I did:
I started by combining the two images into one single image:
This allowed a reduction in server requests from 2 to 1. Instead of asking the server for and image, then another, the browser only has to ask for a single image here. Also the total size of the single image is 1287 bytes. Compare this to 1441 bytes for the combined images. (Note that I am using 16 color gifs for both of these, as opposed to the 128 color originals. See my post on this.)
The second part of this process was to change the html to call the single image, use an image map to separate the links, and make sure it was valid XHTML, then measure the results in bytes.
342 bytes the old way:
396 bytes the new way:
So, the html for the new way is actually a little bigger. But that is ok because our total weight of the images combined with the html is actually less. 1783 bytes the old way, 1683 bytes the new way – we save a total of 100 bytes. Doesn’t sound like much, does it? So I guess we will justify the whole process by saying that we’ve reduced the hits to the server in this process from 2 images to only 1.
Like I said, it’s like eeking out an extra 10 horsepower from a 400 horsepower engine. OK, maybe more like an extra 5, but it was fun, wasn’t it?
I was recently working on one of my sites and had added the W3C buttons for valid XHTML and CSS (which actually validate, by the way). I regularly run speed reports on my sites as well and when I added these two buttons, I was not pleased with the result. Call me picky, but the extra image weight wasn’t necessary for what these buttons are. Since they are more for show and don’t really serve purpose for the user, why add the weight?
So I took the buttons and reduced the number of colors in the gif to see what we could do without onhealthy.net losing too much in the way of image quality. The originals were 128 colors. I found the least I could reduce it to and without losing too much quality was 16 colors. The results were pretty good, I think. The XHTML button was reduced in size from 1.68k to 805 bytes. The CSS was even better going from 1.23k to 656 bytes. Now I can load both buttons for less than the cost of the original XHTML button.
Here are the results. Feel free to use them in place of the originals (if your pages do in fact validate).
|Original (128 colors)||Optimized (16 colors)|