Performance: Lazy loading
HIGH IMPACT
Lazy loading improves page load speed by deferring offscreen images and resources until needed, reducing initial data transfer and rendering time.
<img src="large-image.jpg" loading="lazy" alt="example">
<img src="large-image.jpg" alt="example">
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Eager loading images | All images parsed and loaded immediately | Multiple reflows as images load | High paint cost due to many images | [X] Bad |
| Native lazy loading (loading="lazy") | Images loaded on demand | Minimal reflows triggered only when images load | Lower paint cost initially | [OK] Good |