Performance: Component file (.svelte) anatomy
MEDIUM IMPACT
This affects the initial page load speed and rendering performance by how the component structure impacts parsing, styling, and DOM creation.
<script> let count = 0; </script> <style> p { color: red; font-size: 16px; } </style> <div><p>{count}</p></div>
<script> let count = 0; </script> <style> div { font-size: 16px; } p { color: red; } </style> <div><p>{count}</p></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Simple, scoped styles with minimal script | Minimal nodes | Single reflow | Low paint cost | [OK] Good |
| Scattered styles and complex scripts | More nodes | Multiple reflows | Higher paint cost | [X] Bad |