How does Google’s Page Speed lossless image compression work?

If you’re really interested in the technical details, check out the source code: png_optimizer.cc jpeg_optimizer.cc webp_optimizer.cc For PNG files, they use OptiPNG with some trial-and-error approach // we use these four combinations because different images seem to benefit from // different parameters and this combination of 4 seems to work best for a large // … Read more

Possible to defer loading of jQuery?

Try this, which is something I edited a while ago from the jQuerify bookmarklet. I use it frequently to load jQuery and execute stuff after it’s loaded. You can of course replace the url there with your own url to your customized jquery. (function() {   function getScript(url,success){     var script=document.createElement(‘script’);     script.src=url; … Read more

PageSpeed Insights 99/100 because of Google Analytics – How can I cache GA?

Well, if Google is cheating on you, you can cheat Google back: This is the user-agent for pageSpeed: “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.8 (KHTML, like Gecko; Google Page Speed Insights) Chrome/19.0.1084.36 Safari/536.8” You can insert a conditional to avoid serving the analytics script to PageSpeed: <?php if (!isset($_SERVER[‘HTTP_USER_AGENT’]) || stripos($_SERVER[‘HTTP_USER_AGENT’], ‘Speed Insights’) === false): ?> … Read more

Optimizing File Cacheing and HTTP2

Let’s clarify a few things: My understanding is that http2 renders optimization techniques like file concatenation obsolete, since a server using http2 just sends one request. HTTP/2 renders optimisation techniques like file concatenation somewhat obsolete since HTTP/2 allows many files to download in parallel across the same connection. Previously, in HTTP/1.1, the browser could request … Read more

LCP time between LightHouse and Performance – Google Chrome

Why is Lighthouse showing much longer load times? The answer is a combination of simulated network throttling and CPU throttling. Simulated Network Throttling When you run an audit it applies 150ms latency to each request and also limits download speed to 1.6 Megabits (200 kilobytes) per second and upload to 750 megabits (94 kilobytes) per … Read more