Performance: Why media components enhance content
MEDIUM IMPACT
Media components affect page load speed and visual stability by adding images or videos that can delay content rendering if not optimized.
<img src="small-optimized-image.webp" alt="Description" loading="lazy" width="300" height="200">
<img src="large-image.jpg" alt="Description">
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large unoptimized image | Low | Multiple (due to layout shifts) | High (large repaint area) | [X] Bad |
| Optimized image with lazy loading | Low | Single (initial layout) | Low (small repaint area) | [OK] Good |
| Full video iframe embed | Medium | Multiple (heavy layout) | High (complex paint) | [X] Bad |
| Video placeholder with deferred load | Low | Single | Low | [OK] Good |