Diego Cardozo
Sr. Web Performance Engineer @ NetSuite
Have a clear goal
100ms
16ms
50ms
1s
Measure early
Measure often
Theory
The CRP is the sequence of steps followed by the browser in order to render a page
Theory
The CRP has 3 main components which can be optimized
Total amount of bytes to be downloaded
Amount of critical resources (HTML, CSS y blocking JS)
Amount of roundtrips needed in order to gather critical resources
Example
Total KB: 11
Critical resources: 3
CRP length: 2
Reduce total amount of bytes
Minify, compress and cache
HTML
CSS
JavaScript
Remove unused styles
Compress images
Example: compressor.io
Compress and unify fonts
Reduce amount of critical resources
Concatenate JS and CSS files
Use media queries on <link> tags to unblock rendering
Write CSS directly on HTML (inline)
Leaving everything inline can be harmful
Write JS directly on HTML (inline)
Still blocks rendering when executed if not marked as async
Shorten the Critical Rendering Path (CRP)
Delay JavaScript execution
Add an async attribute to <script> tags so that they don't block rendering
Code optimizations