Repeated experiments - by Google, Amazon, and many smaller websites - have shown that lower latency directly translates to higher conversion rates, so I wouldn't be surprised if this results in billions of dollars of extra commerce, and even a small website would get noticeably higher revenue if they did this. Google also ranks faster websites higher, and so you get an SEO benefit as well.
* Being able to embed comments which aren't visible to the world is very useful.
* Being able to remove non-important whitespace removes clues on the complexity of generation (though it's a super-complex thing to actually remove only the non-important whitespace thanks to <pre> and CSS styling).
* Linting is another area where things are interesting too. Validators might tell you if your HTML is well structured per the specs, but my js skills and habits have improved as a result of linting. The process might tell you that it's best practice to use readonly instead of readonly="readonly" on an element or similar. Sure, not directly related to minification, but the parsing needs to be done already.
* Minification adds some security through obscurity by making stuff like XSS attacks slightly more difficult (if you use name/id/class mangling). I've only seen this in practice on gmail (most gmail browser addons/scripts break every couple of months when google changes something that alters the generated button ids)
I haven't seen minification done on raw HTML, but have seen non-html solutions used in order to be able to include comments - this is a bit dumb to me.
I've used HTML preprocessors to concatenate separate (single page app) html resources (templates) for delivery, so the pipeline's already there.
EDIT: Especially in mobile/touch-only browsers who are extremely unlikely to inspect the code. So do it for m.example.com, I reckon.
I myself have gotten a little lazy, because I'm hosting my static websites behind CloudFlare who do minification anyway, so I haven't thought much of this in a while.
It adds complexity to your setup and server side load. I would not call that barely anything.
But you can minify your HTML at least.
Wow. Yes. I would even say taking more than a single second is pretty unacceptable. There's a bad algorithm in there somewhere...
Also, please, whenever you publish benchmarks, always include the specifications of the system they were performed on! 52KB/s may be horribly slow on a 3GHz i7 but pretty good for a 100MHz Pentium.
These were done on 2.3GHz Core i7 & OS X 10.9.4.
Note that "max" settings were used, meaning that, for example, both JS and CSS had to be minified (and that's delegated to UglifyJS2 and clean-css packages correspondingly).
I build all my templates in HTML, and then store all the different content to populate the templates in script tags. I can then use JavaScript to swap it out, and even hide/reveal unused templates.
It's 100% valid though, handlebars are not valid HTML, at least not until processed and rendered.
The big issue right now is IE support, but most browsers are coming along with it:
To me it's mainly for cosmetic purposes -- partly because Google does it and I want to be like Google -- and because I want to give a little "fuck you" to my competitors who will inevitably try to read my source.
/*
* _ _
* | (_)
* __| |_ ___
* / _` | |/ _ \
* | (_| | | __/
* \__,_|_|\___|
*
*/
No biggie, but had to manually remove them from my code.
1.- The characters "> <" need to be present (they are inside the X in Clearfix:
2.- Only breaks when pasting inline CSS with no enclosing <style>: https://gist.githubusercontent.com/sogen/e2ec898e586a9cb9e33...
removing the " > < " makes it work.
HTML-minifier seems like a good solution, thanks, will try it out.