The fastest and best optimized resource is a resource not sent. Of course, this may seem like an obvious statement, but in practice it is all too often overlooked: as a performance engineer, it is your job to always maintain a critical eye for any opportunity to eliminate unnecessary resources from your application. It’s a good practice to question, and periodically revisit, the implicit and explicit assumptions with your team. A few examples:
- We’ve always included resource X on our pages, but does the cost of downloading and displaying it offset the value it delivers to the user? Can we measure and prove its value?
- Does the resource — especially if it is a third-party resource — deliver consistent performance? Is this resource in the critical path, or need to be? If the resource is in the critical path, could it be a single point of failure for our site - i.e. if the resource is unavailable, will it affect performance and the user experience of our pages?
- Does this resource need or have an SLA? Does this resource follow performance best practices: compression, caching, and so on?
All too frequently our pages contain resources which are unnecessary, or worse, hinder page performance without delivering much value to the visitor or the site they are hosted on. This applies equally to first-party and third-party resources and widgets:
- Site A has decided to display a photo carousel on its homepage to allow the visitor to preview multiple photos with a quick click — all the photos are loaded when the page is loaded, and photos are advanced by the user.
- Question: have you measured how many users view multiple photos in the carousel? You could be incurring high overhead by downloading unnecessary resources which are never viewed by most visitors.
- Site B has decided to install a third-party widget to display related content, improve social engagement, or provide some other service.
- Question: have you tracked how many visitors use the widget or click-through on the content provided by the widget? Is the engagement generated by this widget enough to justify its overhead?
As you can see, while eliminating unnecessary downloads seems like a trivial statement, in practice it is anything but, as it often requires a lot of careful thinking and measurement to make the call. In fact, for best results you should periodically inventory and revisit these questions for each and every asset on your pages.