Checklist for a better web application performance
Performance is crucial in today's web applications. A slow app feels buggy to the users and makes them flee it. Although performance is such an important topic, there are so many optimization vectors that it's easy to forget some of them. The intent of this checklist is to gather performance practices to apply when developing a web application.
While we apply these practices, we should always keep the following rules in mind:
Don't optimize too early
Don't let performance ruin productivity
Always check an optimization is efficient by measuring performance before and after it
Objectives
Frontend
Optimize images
Images represent in average ~60% of a page's weight, thus it's an important part to optimize.
Reduce code size
Reduce number of requests
Prepare next requests
We can use prefetching to prepare the browser to next requests and make them faster or even instant. This article is a few old but explains well the following techniques.
Optimize time to rendering
Ideally the critical code should fit in 14KB in order to be server in the first TCP roundtrip (why 14KB?). These techniques help to achieve this goal.
Optimize fonts
Make animations smooth
User perceived performance
User-perceived performance is often disregarded but can be more important than actual performance. These techniques allow us to improve it.
Backend
General
Provide batch queries/transactions instead of making the client send multiple requests
Identify & optimize slow resources
Parallelize slow tasks
Use relevant data structures
Don't overuse serialization
Generate static content when deploying so that it will be computed only once
If possible, use jemalloc to improve memory allocation