Performance: Arithmetic operations
LOW IMPACT
Arithmetic operations in Sass affect the CSS generation speed and can impact the final CSS size and complexity, influencing page load and rendering.
$base-spacing: 1rem; $gap: $base-spacing * 10 + 0.3125rem; .container { margin: $gap; }
$base-spacing: 1rem; $gap: $base-spacing * 10 + 5px; .container { margin: $gap; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Mixed units arithmetic in Sass | 0 (build time only) | 0 (build time only) | Higher due to complex CSS calc() | [X] Bad |
| Consistent units arithmetic in Sass | 0 (build time only) | 0 (build time only) | Lower due to simple CSS values | [OK] Good |