2

Google Pagespeed says that we should minify our HTML-output. So we did this (using Minify-library and Minify_HTML::minify($content);)

The warning went away, and our pagespeed score dropped around 5 points on both mobile and desktop. We retested this and it's reproducible.

Any insight would be appreciated.

Printscreens

Mobile with minified HTML Mobile with minified HTML

Desktop with minified HTML Desktop with minified HTML

Mobile with unminified HTML Mobile with unminified HTML

Desktop with unminified HTML Desktop with unminified HTML

  • These various websites annoy me. They often make recommendations that sound good, but end up having a negative effect. On one hand, it is nice that they do this, however, the reality is that it is nearly impossible to make recommendations that applies well to all sites. To that end, each recommendation on each site has to be taken with salt, tried, and possibly ignored. The good new is that these are just recommendations and not factors per se'. Do the best you can. – closetnoc Aug 17 '16 at 17:16
  • Sure. We are already at 91/97 without HTML-minifying and 85/95 with HTML-minifying. It's not that we are unsatisfied with those values - they are great. It's more an academic question, why we have a lower value when even Google recognizes (because the warning is gone) that the new version is better... – Raphael Jeger Aug 17 '16 at 17:20
  • 1
    The score is broken down into sections though. What section dropped when you started minifying your code? If you're trying to minify on the fly, that could give a negative impact indeed. – Andrew Lott Aug 17 '16 at 17:24
  • You got me. What gets me is that they recommend Lossless on all images even when they are tiny as hell. ;-) What is the point? Speed is what is important. Basically, it is Googles opinion created by several people. Who knows how stove-piped the whole operation is? It could be one person not talking to another. I do not dwell on these matters unfortunately. I do not have the patience for such things. The price for getting old. Cheers!! – closetnoc Aug 17 '16 at 17:25
  • 1
    90% of minifying HTML is removing leading and trailing white space from each line. The minify library looks like it may be rewriting your CSS (or at least the links to it). I just remove all leading and trailing whitespace from my PHP files as part of the deployment step. When you do that, they produce mostly minified HTML. – Stephen Ostermiller Aug 18 '16 at 10:06
1

Pagespeed is a guide not a rulebook. Aiming to get 100/100 means you've followed a guide to serving a better site but it by no means translates into Google giving you higher metrics for rankings.

Even worse, Google's own products very often break the guide they set out. Some of their best practices (Google CDN delivered js files) also break the Pagespeed guide (not minified).

Take it as advisory and create your own tests based on known metrics for performance:

  • How easy to use is your site?
  • How fast is the page/DOM loading?
  • How does that vary depending on location?
  • I know all of that. Our page is superfast, easy to use and we have high pagespeed-scores. But still it makes absolutely no sense that they tell us to minify HTML (which in itself makes sense) and when we do, they lower our score, albeit having one error less. – Raphael Jeger Aug 18 '16 at 9:12
  • It honestly doesn't bode thinking about. It's not a guide designed for experienced professionals and it's flaws are deeper than calculation errors. – L Martin Aug 18 '16 at 10:37
  • So where's the guide for us experienced pros? ;) – Raphael Jeger Aug 18 '16 at 11:11
  • Experience has taught me to by cynical about guides. Trying to please Google is a moving target - full of convoluted contradictions. We were told not to split site design. Now responsive sites are going out and AMP is replacing them which is splitting designs. To cut a long story short - Pick what works for your business, not what works for Google. Make it lightning fast, easy to use and accessible. – L Martin Aug 18 '16 at 11:26
  • I, as a webmaster who's actively trying to rank on Google, wouldn't be so quick to discard Google Pagespeed as a "rulebook". The same metrics appear in google analytics and the count of pagespeed suggestions is included for each page. Google has confirmed pagespeed is a ranking factor, and while it may not be a major needle mover on its own, I definitely want to be focused on this specific metric (cause after all, I'm trying to please both Google and my visitors). – Rok Sprogar Aug 18 '16 at 12:43
0

The only explanation I can think of is that the variance in other factors might have been behind this.

Could have been anything, but one thing that comes to mind is that the server response time increased because of the time required to minify html on the fly. If, for example the server response time increased from 0.05s to 0.15s, the total pagespeed could have been worse off than without html minification, except the rule for server response time still didn't fire (because it only displays when the server response time jumps above 0.2s).

Also, the warning for render-blocking resources switched from "should fix" to "must fix", which indicates that something else is indeed going on behind the scenes. But like I said, based on the screenshots you provided, I have no way of knowing what exactly that could be.

  • what more would you need to see to know more exakt? – Raphael Jeger Aug 18 '16 at 13:31
  • you can check the wait time for the first html response on the waterfall in any browser with and without minification and see if minifying on the fly actually reduces the response time – Rok Sprogar Aug 18 '16 at 19:32
  • you could also run the same pagespeed test on a pre-minified php version of the page...so a php page that still executes all other php functions except the minification but outputs the same minified html...or even compare that to the speed of a purely static minified .html version of the same page to eliminate any php processing from the equation – Rok Sprogar Aug 18 '16 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.