0
0
Astroframework~8 mins

Choosing the right framework for each island in Astro - Performance & Optimization

Choose your learning style9 modes available
Performance: Choosing the right framework for each island
HIGH IMPACT
This affects page load speed and interaction responsiveness by optimizing how much JavaScript is sent and run on the client.
Rendering multiple interactive UI islands on a page
Astro
Choose lightweight frameworks like Preact or Solid for small islands and React only for complex ones, loading only needed runtimes.
Reduces JavaScript size and parsing time, speeding up initial paint and interaction readiness.
📈 Performance GainSaves 150-250kb per island, reduces blocking time to under 50ms, improves LCP and INP
Rendering multiple interactive UI islands on a page
Astro
Use a heavy framework like React for every island regardless of complexity, importing full React runtime for each.
This loads large JavaScript bundles multiple times, increasing page load and blocking rendering.
📉 Performance CostAdds 200-300kb per island, blocks rendering for 200+ ms, increases LCP and INP
Performance Comparison
PatternDOM OperationsReflowsPaint CostVerdict
Heavy framework for all islandsHigh (many nodes with framework wrappers)Multiple reflows per islandHigh paint cost due to large JS[X] Bad
Lightweight framework per islandMinimal DOM overheadSingle reflow per islandLow paint cost with small JS bundles[OK] Good
Rendering Pipeline
Choosing the right framework affects how much JavaScript is parsed and executed, impacting style calculation, layout, and paint.
JavaScript Parsing
Style Calculation
Layout
Paint
Composite
⚠️ BottleneckJavaScript Parsing and Execution
Core Web Vital Affected
LCP, INP
This affects page load speed and interaction responsiveness by optimizing how much JavaScript is sent and run on the client.
Optimization Tips
1Use lightweight frameworks for small interactive islands to reduce JavaScript size.
2Avoid loading heavy frameworks multiple times on the same page.
3Load framework runtimes only when needed to minimize blocking time.
Performance Quiz - 3 Questions
Test your performance knowledge
What is the main performance benefit of choosing a lightweight framework for small islands?
ASmaller JavaScript bundles reduce load and parsing time
BMore DOM nodes are created for better structure
CMore CSS styles are applied for better visuals
DMore reflows happen to update layout faster
DevTools: Performance
How to check: Record a page load and interaction, then analyze scripting time and main thread blocking.
What to look for: Look for long scripting tasks and large JS bundles causing delays in first paint and input responsiveness.