Performance Optimization Tips for AI Lab Pages
Our labs only feel magical when they load faster than a screenshot. Here are the tweaks we rely on.
1. Lazy-load scripts
Keep render-blocking assets minimal. We load heat.js and share-copy.js async; only product.js and usage.js block painting.
2. Cache AI responses
Wrap /api/generate in a short TTL cache keyed by type + prompt. Repeat runs become instant, reducing OpenAI/Gemini calls.
3. Optimize CSS & animations
Combine gradients in styles.css, leverage prefers-reduced-motion, and test Lighthouse regularly to keep LCP below 1s.
Further reading