AO has gotten faster since version 2.0.0, but the fact remains that if aggregated CSS or JS is not in AO’s cache, the actual minification does have a performance impact.
Most of the time it is inline JS (or CSS) that breaks the cache, so not aggregating inline JS and/ or CSS (test which ones impact performance) should help.
Lastly using the API, you can tell AO not to aggregate & minify or to aggregate but not to minify CSS and/ or JS for logged in users. I’ll be happy to provide example code for that.
let me know how things go! 🙂
frank
Thread Starter
aand
(@aand)
Hi Frank, thanks for the ideas! I’m excited to give it a go. Testing performance for logged in users is quite tricky, as none of the regular test sites can do that. Any thoughts on how it can be done (rather than just going by whether it feels fastwr/slower). Also the API approach sounds interesting – so would be really interested in seeing the code you mention.
Thanks again!
re. testing; you can script webpagetest.org to log in, cfr. documentation here
example of code to disable JS minification for logged in users;
add_filter('autoptimize_js_do_minify','loggedin_no_minify');
function loggedin_no_minify() {
if (is_user_logged_in()) {
return false;
} else {
return true;
}
}
similar code can be used to disable optimization entirely for JS and/ or CSS or to aggregate but not minify CSS.
frank
The waterfall view in Chrome’s Dev Tools — which will show if you’re logged in or out — can be exported to an HTTP Archive (HAR) file. Then you can contrast & compare logged in user performance vs. logged out user performance.