-
-
Notifications
You must be signed in to change notification settings - Fork 327
[Bug]: mergeRules OOMs with 20k adjacent equal rules #1747
Copy link
Copy link
Closed
Labels
Description
Describe the bug
We recently encountered a memory exhaustion issue during CSS optimization of a large generated CSS file. The root cause appears to be that mergeRules has O(n²) performance and there are several duplicate streams of work (e.g. mapping the same data twice) for max() and min().
Expected behaviour
Compiles OK
Steps to reproduce
scss
@for $i from 1 through 20000 {
.foo-#{$i} {
color: red;
}
}
Version
7.0.5
Preset
default
Environment
OS: Linux 6.16 Debian GNU/Linux
CPU: (16) x64 Intel(R) Xeon(R) CPU @ 2.00GHz
Memory: 93.77 GB / 102.17 GB
Container: Yes
Shell: 5.9 - /usr/bin/zshPackage details
irrelevantAdditional context
Although it is possible to fix the problem by increasing memory, there are some low hanging fruit in the implementation that I'd like to contribute a fix.
Reactions are currently unavailable