Front End Performance Checklist
Front End Performance Checklist
Below you’ll find an overview of the front-end performance issues you might
need to consider to ensure that your response times are fast and smooth.
____
Get Ready: Planning and Metrics
☐ Critical payload chunk = 14KB, critical file size budget < 170KB
The first 14KB of the HTML is the most critical payload chunk — and the only part of the
budget that can be delivered in the first roundtrip. To achieve goals stated above, operate
within a critical file size budget of max. 170KB gzipped (0.7-0.8MB decompressed) which
already would take up to 1s to parse and compile at 400ms RTT on an average phone.
Make sure your budgets change based on network conditions and hardware limitations.
☐ Pick your battles wisely: React, Vue, Angular, Ember and Co.
Favor a framework that enables server-side rendering. Be sure to measure boot times in
server- and client-rendered modes on mobile devices before settling on a framework.
Understand the nuts and bolts of the framework you’ll be relying on. Look into the PRPL
pattern and application shell architecture.
Assets Optimizations
Delivery Optimizations
☐ Stream responses.
Streams provide an interface for reading or writing asynchronous chunks of data, only a
subset of which might be available in memory at any given time. Instead of serving an empty
UI shell and letting JavaScript populate it, let the service worker construct a stream where the
shell comes from a cache, but the body comes from the network. HTML rendered during the
initial nav request can then take full advantage of the browser's streaming HTML parser.
☐ Consider making your components connection-/device memory-aware.
The Save-Data client hint request header allows us to customize the application and the
payload to cost- and performance-constrained users. E.g, you could rewrite requests for high
DPI images to low DPI images, remove web fonts and fancy parallax effects, turn off video
autoplay, server pushes or even change how you deliver markup. Use Network Information
API to deliver variants of heavy components based on the network type. Dynamically adjust
resources based on available device memory, too, with Device Memory API.
HTTP/2
Quick wins
This list is quite comprehensive, and completing all of the optimizations might take quite a while.
So if you had just 1 hour to get significant improvements, what would you do? Let’s boil it all
down to 12 low-hanging fruits. Obviously, before you start and once you finish, measure results,
including start rendering time and SpeedIndex on 3G and cable connections.
1. Measure the real world experience and set appropriate goals. A good goal to aim for is First
Meaningful Paint < 1 s, a SpeedIndex value < 1250, Time to Interactive < 5s on slow 3G, for
repeat visits, TTI < 2s. Optimize for start rendering time and time-to-interactive.
2. Prepare critical CSS for your main templates, and include it in the <head> of the page. (Your
budget is 14 KB). For CSS/JS, operate within a critical file size budget of max. 170KB
gzipped (0.7MB decompressed).
3. Trim, optimize, defer and lazy-load as many scripts as possible, check lightweight alternatives
and limit the impact of third-party scripts.
4. Serve legacy code only to legacy browsers with <script type=“module">.
5. Experiment with regrouping your CSS rules and test in-body CSS.
6. Add resource hints to speed up delivery with faster dns-lookup, preconnect, prefetch and preload.
7. Subset web fonts and load them asynchronously, and utilize font-display in CSS for fast first
rendering.
8. Optimize images, and consider using WebP for critical pages (such as landing pages).
9. Check that HTTP cache headers and security headers are set properly.
10. Enable Brotli or Zopfli compression on the server. (If that’s not possible, don’t forget to enable
Gzip compression.)
11. If HTTP/2 is available, enable HPACK compression, and start monitoring mixed-content
warnings. Enable OCSP stapling.
12. If possible, cache assets such as fonts, styles, JavaScript and images in a service worker cache.
A huge thanks to Guy Podjarny, Yoav Weiss, Addy Osmani, Artem Denysov, Denys Mishunov, Ilya Pukhalski,
Jeremy Wagner, Colin Bendell, Mark Zeman, Patrick Meenan, Leonardo Losoviz, Andy Davies, Rachel Andrew,
Anselm Hannemann, Patrick Hamann, Andy Davies, Tim Kadlec, Rey Bango, Matthias Ott, Peter Bowyer, Phil
Walton, Mariana Peralta, Philipp Tellis, Ryan Townsend, Ingrid Bergman, Mohamed Hussain S H, Jacob
Groß, Tim Swalling, Bob Visser, Kev Adamson, Adir Amsalem, Aleksey Kulikov and Rodney Rehm for
reviewing the article, as well as our fantastic community, which has shared techniques and lessons learned
from its work in performance optimization for everybody to use. You are truly smashing!