Performance: Why optimization matters for performance
CRITICAL IMPACT
Optimization affects how fast the page loads and how smoothly it responds to user actions.
import Image from 'next/image'; export default function Page() { return ( <> <Image src="/large-image.jpg" alt="Large" width={600} height={400} priority /> <script async src="/heavy-script.js"></script> <div>Content</div> </> ) }
export default function Page() { return ( <> <img src="/large-image.jpg" alt="Large" /> <script src="/heavy-script.js"></script> <div>Content</div> </> ) }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Unoptimized images and blocking scripts | High (many nodes and large assets) | Multiple reflows due to delayed layout | High paint cost from large images | [X] Bad |
| Optimized images with Next.js Image and async scripts | Moderate (optimized nodes) | Single reflow after fast layout | Low paint cost with compressed images | [OK] Good |