-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sass compiles VERY slowly since v1.59
(8 times slower than v1.58
)
#1913
Comments
v1.59
v1.59
v1.59
v1.59
v1.59
v1.59
((8 times slower than v1.58
)
v1.59
((8 times slower than v1.58
)v1.59
(8 times slower than v1.58
)
I'm seeing the same issue after moving up to |
v1.59
(8 times slower than v1.58
)v1.59
(8 times slower than v1.58
)
Ok, so since you are running the |
+1 to this issue. In our case the previous compile time was a few seconds, but now it's 15 minutes plus, long enough for our builds to start timing out. I am attempting to put together a minimal reproduction of the problem - as in, a stylesheet which compiles quickly under 1.58.3 but slowly under 1.59.0 - but our CSS is very complicated and pulls in a lot of third-party styles, so it's taking me some time. I am guessing that this was introduced under https://github.com/sass/dart-sass/pull/1903/files but that is only a guess. This doesn't seem to be anything to do with repeated SCSS module loading - so far my minimal stylesheet is just one (extremely long) file, with no Something I have noticed is that we make extensive, repeated use of this pattern: .#{$prefix}--data-table--short thead tr,
.#{$prefix}--data-table--short tbody tr,
.#{$prefix}--data-table--short tbody tr th {
height: rem(32px);
}
// and similarly, about 200 more times , we have .bx--data-table--short thead tr,
.bx--data-table--short tbody tr,
.bx--data-table--short tbody tr th {
height: rem(32px);
}
// ... etc. then compile time seems to drop back to normal. |
same with me |
Currently working on investigating this. Just to check, is everyone here using the JS-compiled version of Sass (the NPM |
NPM "sass" package (javascript). |
I'm using NPM sass too |
I'm also using the npm sass package, as explained in my first comment. Thank you for the investigation. 👍 |
I can confirm the same regression with dart-sass-embedded with interpolation in selector. |
Yeah, it looks like the root cause of this might be the call to getText here: https://github.com/sass/dart-sass/blob/main/lib/src/interpolation_map.dart#L156. |
The latest version of Dart Sass (1.59.3) should fix this from the tests I've run on both Node and the Dart VM, so please let me know if you're still encountering performance issues on 1.59.3 that weren't present on 1.58.x. |
@jathak I'm still encountering performance issues on
|
|
If we want to fix the regression without reverting the feature, we probably have to improve the performance of Not sure if it is feasible, maybe we can get span information for interpolation during parse stage and store it in AST, so that we don't have to backtrace it during compile stage. |
Right, I forgot about source maps. I can think of a few possibilities that could speed things up on the margins, but I think it makes sense to wait until Natalie gets back on Monday to discuss with her about any more complicated changes here. In the meantime, @Elysiome, given your compilation was already taking 28 seconds before this change, you may want to consider using the |
Well, the npm package looks very easy to migrate. But I have to install Dart in order for sass to work, right? I'll try. |
The Dart VM is embedded in the npm package. |
I've just tried
/*!
* Select2 v4 Bootstrap 5 theme v1.3.0
*/
@import "node_modules/bootstrap/scss/functions";
@import "node_modules/bootstrap/scss/variables";
@import "node_modules/bootstrap/scss/mixins";
@import "include-all";
What would you recommend to me, please? Should I use |
While sass-embedded is designed as a drop-in replacement, performance wise there are a few caveats:
Related performance issues: |
I'm using
I'm currently using the
I've about 20 entry points, but a lots of partial files (at least 100) are used to render these 20 files. By the way, do you have any idea for the |
I suspect there are some inconsistency in sass-embedded's legacy API emulation with the sass' implementation. |
As of |
@Elysiome Can you open a separate issue with a stand-alone reproduction of the import failure you're seeing? |
I'm going to re-open this as I look into a way to handle this even if spans are eagerly materialized. dart-lang/source_span#93 should allow us to expand these spans without allocating a bunch of large strings. |
I use native dart sass for compilation big sass file. If I use --embed-source-map it compiles VERY slowly since from version 1.59.0, up to 1.60.0. Version 1.58.3 comile it in 1.5 sec, version 1.60.0 - 13 sec. Without source maps speed almost the same (but little bit longer maybe just for 100ms) |
Can confirm that there's a noticeable slowdown as I finally upgraded from 1.45.1 to 1.60.0 today. I am running sass-cli to compile my Sass (one entrypoint file and --style expanded --load-path option pointed to node_modules). Compile went from around 5s to 1min 20s. Downgrading to 1.58.3 brought it back down to 5s. The next version that I could install (1.59.1) took 7min 30s to compile. So while the latest version is drastically better than 1.59.1 was, it is still drastically slower than 1.58.3. I am using Node v16.17.0. Going to downgrade to 1.58.3 for now. |
Instead of calling `SourceFile.getText()`, which creates string copies of a substantial subset of the text of the file every time, this directly accesses the file's underlying code units without doing any copies. Closes #1913
Instead of calling `SourceFile.getText()`, which creates string copies of a substantial subset of the text of the file every time, this directly accesses the file's underlying code units without doing any copies. Closes #1913
Instead of calling `SourceFile.getText()`, which creates string copies of a substantial subset of the text of the file every time, this directly accesses the file's underlying code units without doing any copies. Closes #1913
1.61.0 is releasing which should fix this issue. If you're still running into performance issues relative to 1.58, please provide a minimal reproduction that shows off the bad performance and I'll take another look at it. |
@nex3 Since my previous comment, I have reorganized my SASS files:
Thus, the performance has been greatly improved (even with the Here's a performance comparison table with my new SASS structure, in case you're interested:
We see a slight drop in performance between |
Introduction
Hi,
I've just migrated from
v1.58.3
tov1.59.2
, and since, Sass compiles VERY VERY VERY slowly. It worked fast underv1.58.3
. My Node.js isv18.14.2
.1.58.3
18.14.2
1.59.2
18.14.2
Has anyone encountered a similar issue? Thanks. 👍
Scenario
I'm using the JavaScript API of Sass through https://github.com/dlmanning/gulp-sass.
Screenshots
v1.58.3
:v1.59.2
:The text was updated successfully, but these errors were encountered: