http://cestdumeleze.net/blog/2011/minifying-the-html-with-asp-net-mvc-and-razor/
This sounds like a reasonable way to minify HTML; My question is if this could be worth it, or if it introduces problems..
Are any potential performance issues I should know about?
I already minify/gzip all of my css/js
Imho, it's a classic case of premature optimization. It won't create problems if done correctly but there are some issues that make it, well, not such a big deal. Nobody uses dialup speeds anymore, not even mobile users, so saving up 1ms makes not that much difference. Furthermore, most web platforms now actively employ gzip over http so your page will already be transparently compressed making this effort all the more unnecessary.
Now, someone is bound to tell that there is no such thing as over-optimizing things, I just beg to differ. Especially if I have to pay someone to do it :)
I personally wouldn't bother. Whitespace makes up a small very small amount of HTML, and if this is being done at runtime you're going to incur a performance hit just doing the minification. (Javascript, on the other hand, can benefit much more since lines of code tend to be short, and the compiler can shorten variable names considerably.)
If you're looking to improve page load time and you've already minified CSS and JS, try hosting your static content from a CDN and/or setting appropriate Expires headers on your content. That can actually make a substantial difference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With