Page 1 of 1

HTML minification

Posted: Fri Jan 21, 2011 6:23 am
by BlackWhiteRed
Ive been looking into my making my website faster and was wondering if I should minify my html. Is this worth it? I guess what I really need to ask is how much speed improvement I can expect to gain from it. Some of my pages are pretty long with text and illustrations, but all in all pretty normal. What do I need to pay attention to in order not to mess things up? Thanks.

Re: HTML minification

Posted: Fri Jan 21, 2011 2:14 pm
by MikeGale
I don't think I've ever gone the minify route with X/HTML.

It's ugly, harder to maintain and of limited benefit.

I don't know any details of your web site. I find a good fast server, compiling the programmed bits and good attention to code design can give lightning speed.

If it's just markup a good fast server still applies. (I've had ISP's move web sites to alternate shared machines to achieve this.)

Working on images is always a good idea and can make a difference. (Note: it's not always the same format that gives you best results, gif, png and jpeg all have their place in the sun.) I'd put that ahead of minification.

I know that some smart people set things up to compress the payload from the server. (gzip) There used to be some problems doing that but I believe it's now much better. I imagine that will also outperform minification.

For a discussion of this issue I found ... nification which gives additional hints, including tools that advise you on what to do.

Another thought. If your site has a lot of JavaScript writing it, be very careful. I've recently seen several high profile sites that do this and simply get it wrong. Their code takes so long to run that you just leave the site before it's done.

Re: HTML minification

Posted: Fri Jan 21, 2011 2:28 pm
by Albert Wiersch
It's hard to help without a link to the site.

Just "compressing" the HTML to remove unnecessary space characters is probably a bad idea and won't help much... but there could other issues that could make a big difference, like large resolutions images that are 500K or larger that are set to display at 200x300 pixels or similar small size. They could easily be downsized and made much smaller in file-size. I've definitely seen that before.

Excessively long pages could also be divided into multiple pages.

Making sure there are no big structural issues in the HTML could also help increase rendering speed (check with a validator like CSE HTML Validator).

And of course what Mike said, a fast server is always good.