Site performance comes down to two issues: - Perceived relevance - Perceived responsiveness Actually, perceived responsiveness could be considered an aspect of relevance (but not the other way around). To be relevant is to be speedy and relevant.
Catch 22 - Speed vs. Functionality
Minification and Caching
The two strategies for speeding up sites are: - Minification (a two part strategy), and - Caching (also a two part strategy). Minification consists essentially in compressing and combining files, with a variety of tools to do so. Compressions means the files are smaller, and combining them means there are fewer, and therefore fewer server requests. Caching involves both placing files closer to the recipient, as well as keeping them there for future requests. This means both initial requests and subsequent requests are opportunities to prefetch through anticipation. And also to cache various different aspects in various different locations, and with a variety of strategies to expire content so that new content is fetched when needed. > note: cookies also have a caching mechanism While minifications are essentially algorithms for compression done just after one or more fragments are constituted, caching is done in a variety of places (browser, forward cache, CDN, web server), and for a variety of things (database, page, object). HTTP headers are one place where caching information is kept.
The Cached and the Uncacheable
In order for these things to work well, there should be a single location where both minification and caching is configured, and a single set of benchmarks that could provide feedback on the best approach for a given site profile. Further, what can and what cannot be cached, and when the can/not caching may or may not be permitted. Various kinds of content might need to be uncachable, at least globally, including: - Location-specific content - information for visitors from certain places, such as currency - Language-specific content - information in specific languages, which may be identified by browser language - Group-specific content - information for people who are a part of a group, such as paying customers, or active leads - User-specific content - information for a specific person, such as their transaction history, available when they are logged in - Newly updated content - should replace any old content that it replaces in all caches In most of these examples, there should be some way of changing preferences (location, language, group), when those options are otherwise free choices.
Instantclick / Turbolinks / Progressive Web Apps
Preloading is essentially what caching is, though where the preload happens can vary. By focusing not on the server-side, but the web application side (Instantclick, Turbolinks) and the browser requestor (Progressive Web Apps). By focusing on optimizing the browser render, these tools become much more responsive, such that relevance is increased (to the degree the application, page or site has the proper functionality and content).
Single Page Applications (SPA)
While PWA supports standard websites and is really trying to fix low bandwidth issues, IC and TL essentially turn websites into single page applications, as the entire page loading process is dispensed with, and only changes to pages are introduced. This is a noticeably faster approach. Unfortunately, much of the development, tools, plugins, etc., out there assume the basic model of a clean DOM for every page being called. This means whack-a-mole forever.
The big problem with minification on Wordpress is that the way plugins interact, the minification process can break things, and ultimately some kinds of content cannot be minified. Thankfully, since plugins are open source on Wordpress, it is possible to fork them and fix them (though a costly, time-consuming task). Ultimately, this kind of fixing needs to be accepted upstream, or a huge amount of ongoing maintenance will be needed. Ultimately, porting a number of plugins into custom posts instead is one option. But again, time and resources needed.
One approach is to strip out all the CSS in every plugin and theme and add it to a single file (or a small set). Maintaining one file is much more manageable.
Pre-minification of Content