Performance: Parallel data fetching pattern
HIGH IMPACT
This pattern affects page load speed by reducing the time to fetch multiple data sources simultaneously, improving the Largest Contentful Paint (LCP).
const [data1, data2, data3] = await Promise.all([ fetch('/api/data1').then(res => res.json()), fetch('/api/data2').then(res => res.json()), fetch('/api/data3').then(res => res.json()) ]);
const data1 = await fetch('/api/data1').then(res => res.json()); const data2 = await fetch('/api/data2').then(res => res.json()); const data3 = await fetch('/api/data3').then(res => res.json());
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Sequential fetches | Minimal | 0 | High due to delayed content | [X] Bad |
| Parallel fetches with Promise.all | Minimal | 0 | Low due to faster content availability | [OK] Good |