Page 1 of 1
pagespeed insights
Posted: Thu Oct 20, 2016 7:27 pm
by Vegan
Google Pagespeed Insights seems to have to suggestions I might be able to fix but I am not if it can be done without breaking my sites
Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
How can I deal with mobile v desktop and the way facebook is good for 20 minutes and facebook is good for 2 hours
I was wondering how to get the caching working better, considering my site is database driven
https://hardcoregames.azurewebsites.net ... s/logo.png (expiration not specified)
https://hardcoregames.azurewebsites.net ... ebfont.ttf (expiration not specified)
https://hardcoregames.azurewebsites.net ... mbnail.png (expiration not specified)
https://hardcoregames.azurewebsites.net ... loader.gif (expiration not specified)
https://hardcoregames.azurewebsites.net ... atured.png (expiration not specified)
https://hardcoregames.azurewebsites.net ... latest.png (expiration not specified)
https://hardcoregames.azurewebsites.net ... search.png (expiration not specified)
https://connect.facebook.net/en_US/all.js (20 minutes)
https://www.google-analytics.com/analytics.js (2 hours)
Re: pagespeed insights
Posted: Fri Oct 21, 2016 3:10 am
by requinix
Vegan wrote:Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
I disagree with that one. They're talking about setting up the assorted files so that the browser does not try to download a new copy for some period of time. The advantage is that you save some bandwidth, but it comes with the disadvantage that if the resource changes then the browser will not get the new version. The workaround is to change the URL using a sort of nonce token, like logo.png?1, that only varies when the resource changes. I don't care for that.
A more sophisticated form of caching uses modification times or ETags. Your server is already configured to do the latter: the server calculates and sends an identifier with the resource, the browser includes the identifier in the next request, and the resource is downloaded only if it hasn't changed. The entire exchange generally takes 100-200 bytes.
Vegan wrote:How can I deal with mobile v desktop and the way facebook is good for 20 minutes and facebook is good for 2 hours
What's your question?
Vegan wrote:I was wondering how to get the caching working better, considering my site is database driven
You'd have to look into whether WordPress supports caching. Otherwise the big gain is with static files and that's already been taken care of.
Re: pagespeed insights
Posted: Fri Oct 21, 2016 7:53 pm
by Vegan
I have very few static files
even those are in the database
Re: pagespeed insights
Posted: Sat Oct 22, 2016 12:07 am
by requinix
That statement doesn't make sense.
If those files are actual files on the server and they do not contain any sort of dynamically-generated content then they are static files. What's what static means: "lacking in movement, action, or change". Whether their paths are stored in a database or whatever is irrelevant so long as the condition holds.
Re: pagespeed insights
Posted: Mon Oct 24, 2016 9:04 pm
by Vegan
aside from images all of the posts are i the database
maybe the google tool is not that good
Re: pagespeed insights
Posted: Tue Oct 25, 2016 4:06 am
by requinix
It's fine, it's just that its recommendation of using Expires header - if it is, in fact, a recommendation and not simply a notice that the header isn't present - tends to require more work on the developer's part (using variable URLs) for what I perceive to be not enough gain (saving a couple hundred bytes per request). Other people may believe differently.
Re: pagespeed insights
Posted: Tue Oct 25, 2016 5:15 pm
by Vegan
I have used the same logo for god knows how long. Why does it need to expires?
same for fonts, they are also invariant
does not make a lot of sense for my site which uses these are core assets to the whole site so they are constants
Re: pagespeed insights
Posted: Tue Oct 25, 2016 9:13 pm
by requinix
They're constant until they change.
If you're sure they won't change for the foreseeable future then go ahead and stick an Expires on them. Just don't pick too long of an expiration: just long enough to save clients from redownloading assets in their current browsing session.
Re: pagespeed insights
Posted: Thu Oct 27, 2016 1:04 pm
by Vegan
not many visitors load a second page, but all of the images flagged are very small so they load very fast
Re: pagespeed insights
Posted: Thu Oct 27, 2016 1:11 pm
by requinix
Then it doesn't really matter what you do.
Re: pagespeed insights
Posted: Thu Oct 27, 2016 7:28 pm
by Vegan
I am wondering if the tool needs to be tuned for wordpress and other popular web platforms
Re: pagespeed insights
Posted: Tue Nov 01, 2016 11:45 am
by Vegan
found this while researching the topic, wonder if this approach would help with blocking stylesheets?
Code: Select all
<script>
var cb = function() {
var l = document.createElement('link'); l.rel = 'stylesheet';
l.href = 'https://static.justwatch.com/static/compile_jw/assets/jw-webapp-0.11.112.css';
var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h);
};
var raf = requestAnimationFrame || mozRequestAnimationFrame || webkitRequestAnimationFrame || msRequestAnimationFrame;
if (raf) {
raf(cb);
} else {
window.addEventListener('load', cb);
}
</script>