Prioritizing web performance
Prioritizing web performance
Back in May, I had the opportunity to attend DrupalCon in Los Angeles with a couple of my fellow web developers. Not only did we learn about all the new and exciting features coming in Drupal 8, but we also had a chance to mingle with great people from companies like Pantheon and Acquia. Oh, and we picked up some sweet swag in the process.
Create a performance budget
One of the key takeaways for me was the concept of a performance budget. A performance budget is a set of goals to be used as a framework, when making performance-related decisions, throughout the lifecycle of a project.
As an example, a performance budget may include the following goals:
- SpeedIndex < 2000, (overall experience)
- Page load time for 3G < 3s, (user retention)
- Page load time for Cable < 2s, (user retention)
- PageSpeed score > 90, (best practices)
- Time to Interact < 1s, (delivering the experience)
After budget goals have been established, they are referred to whenever a performance-related decision is to be made. For instance, if a new feature is to be added that will push you over one of your performance goals, you need to ask yourself:
- Can we make room by optimizing an existing feature?
- Can we make room by removing an existing feature?
- Do we really need this feature, or can it be removed altogether?
This way, you think critically about features that are added to your project. If you’re a web developer, you have probably experienced the horror firsthand, trying to fix these performance issues after a site has launched. It’s not fun, and can damage the reputation of your company.
So, we have defined goals that the whole team is working towards. This is when great things start to happen:
- We identify and address performance-related issues early
- We are forced to consider performance as a constraint when designing for the web
- We present the client with a more accurate representation of what they can expect to receive
- We eliminate the common excuses of limited time or budget
- We produce a superior product to that of our competitors
Another key component is the use of an automated testing platform like Travis CI. It is crucial to run tests whenever new code is added to your repository. Ideally, these would be run after a pull request has been issued and tracked over time with a dashboard.
There are a number of tools out there to help you test common metrics, here are a few of the big ones:
By defining performance goals early and using them to make decisions throughout the course of the project, your web development team will focus on balancing user experience with the speed of its delivery. Over time, the team will see how different elements affect performance and will be able to use this knowledge to efficiently plan future projects.