Web Performance Optimization
# Web Performance Optimization
Every millisecond matters. Faster sites have better conversion, engagement, and SEO.
## Core Web Vitals
**LCP (Largest Contentful Paint)**
Main content should load in < 2.5s. Optimize images and server response.
**FID (First Input Delay)**
Interactivity in < 100ms. Reduce JavaScript execution.
**CLS (Cumulative Layout Shift)**
No unexpected layout shifts. Reserve space for dynamic content.
## Optimization Techniques
**Critical CSS**
Inline above-the-fold CSS. Defer the rest.
**Code Splitting**
Load only what's needed. Lazy load routes and components.
**Image Optimization**
- WebP format
- Responsive images
- Lazy loading
- CDN delivery
**Caching Strategy**
- Service workers
- HTTP caching headers
- CDN configuration
## Measuring Performance
- Lighthouse
- WebPageTest
- Real User Monitoring (RUM)
Performance is a feature. Prioritize it.
