-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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 Performance regression after update from v14 to v15 #26020
Comments
Hi @JonWallsten, You mentioned that you are using |
@alan-agius4 That is correct. I assumed the AngularWebpackPlugin was using the CLI in the background. But that might have been a bad guess from my side. Can you move the ticket to the repo where it belong? |
I did notice that you are using the async version of Sass Maybe the components team increased the imports/use which could causing "expected" performance degradations when Sass is used in async mode, as these can be up to 2x slower than the sync version. Over the years in the Angular CLI we did several Sass compilations performance improvements that are typically caused by async compilations. However, since you are not using the Angular CLI to compile your application, fine tuning and optimizing the build is your responsibility. Transferring to the material repo since they might have better knowledge on what changed, but since you are using your own build pipeline there is not much we can do here. |
@alan-agius4 I hear that I need to read up on async/sync version of sass. Was not aware of that. Thanks! |
https://sass-lang.com/documentation/js-api/
https://sass-lang.com/documentation/js-api/modules#compileAsync
|
Is the CLI using async or sync mode? The CLI is also using Edit: Oh, I see that your using your own custom code for that. |
@clydin, mentioned that the root cause is likely that in material version 15 has a significant amount of new imports due to the MDC change. With around 40 additional dependencies. This means that there are a lot more package resolution attempts when processing material stylesheets. |
I haven't put any time in getting to know the processes behind the processing of sass in general since it usually just works. But now that it takes the majority of the build time I want to know how to improve the situationen. Is there anything I can do? Import less material modules? Skip theming? Or do I get everything anyways when using mat.core? |
@alan-agius4 Using the synchronous version with Do I understand it correctly that you guys have you own importer/resolution code? How much faster is that compared to webpack's importer? You also have your own workers? |
Yes, with
Just to give some context, We also use use workers do that each Sass compilation is non blocking while we force the resolvers to run in sync manner. The Angular CLI integration is significantly faster, Example: styles.scss
The timings here are totally expected as Sass is around 50% slower when ran in async mode (webpack-contrib/sass-loader#701) |
With sass-loader, Sass compilation is always run in async mode. There is no option to force the sync behaviour.
No, the implementation is private. |
@alan-agius4 I see. Then I guess we're out of options and have to accept the |
@alan-agius4: I've spent the morning catching up on all ongoing initiatives with speeding up SASS. Like: So, since I'm out of alternatives I've copied to files from |
It's unfortunate to hear your build times are slower using the repo, and it is likely due to the increased deps on MDC. In this case it doesn't look like there's anything we can do to help |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build
Is this a regression?
The previous version in which this bug was not present was
14.2.2
Description
I've just updated angular from
14.2.2
to15.0.0
and I see increased build times with50%100% (15.0.4).It seems related to SASS. I remember I had similar issues when upgrading to v12, but that time there was a migrator guide.
I did a CPU-profile, and it, together with all our
scss
files (except the components), is uploaded here:https://github.com/JonWallsten/monorepo-new/tree/sass-debug/temp
We have multiple apps, but I uploaded one app and the shared library (built with ng-packagr) as an example.
Please note that the profile is not capturing the entire build since DevTools crashes when trying. But it's clear enough that SASS is the issue since the time it covers in the profile is the same time the full build dock in the previous version.
Chart: (The green color is sass-related)
Here's a "Bottom up" list from one of my profiles:
Please let me know if I can collect enable some other debugging information.
Minimal Reproduction
Since this happens in a complex setup with many files I'm not sure it would be easy to detect the issue with a few files. I think it's a situation where small thing adds up in the end.
Exception or Error
No response
Your Environment
Anything else relevant?
We're using
AngularWebpackPlugin
to build.And we have a monorepo setup with
paths
TSConfig
tsconfig.build.json
../../tsconfig.json
The text was updated successfully, but these errors were encountered: