Optimizing Astro Performance
While Astro is fast by default, there are several techniques you can use to optimize your site even further.
Image Optimization
Use Astro's built-in Image component for automatic optimization:
---
import { Image } from 'astro:assets';
import heroImage from '../assets/hero.jpg';
---
Smart Component Hydration
Choose the right hydration strategy for your components:
client:load- Load immediatelyclient:idle- Load when browser is idleclient:visible- Load when scrolled into viewclient:media- Load based on media query
Code Splitting
Astro automatically splits your code for optimal delivery. Each page is compiled independently, ensuring users only download what they need.