Performance: Built-in list functions
MEDIUM IMPACT
Using built-in list functions affects the CSS preprocessing speed and the size of the generated CSS, impacting initial page load and style application.
$my-list: 1 2 3 4 5; $len: length($my-list);
@function manual-list-length($list) { $length: 0; @each $item in $list { $length: $length + 1; } @return $length; } $my-list: 1 2 3 4 5; $len: manual-list-length($my-list);
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual list iteration in Sass | 0 (preprocessing only) | 0 | 0 | [OK] |
| Using built-in list functions (e.g., length()) | 0 (preprocessing only) | 0 | 0 | [OK] Good |