-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Browsers.parse takes 70% of the autoprefixer time #1256
Comments
Are we talking about single Autoprefixer run or on processing multiple files? Browserslist has an in-memory cache for config lookup https://github.com/browserslist/browserslist/blob/c806b2441179b15cee6eb6a783e754be6b332d20/node.js#L241-L244 |
Our case is processing many files in a single webpack build. Looking at the cache code it seems to cache based on CSS file path. We have files in many folders - but all resolve to the same browser list file. |
Cache should be based on folder path. The problem is that you can put But I have an idea how to speed this search a little. |
Hope it improved Browserslist caching browserslist/browserslist@86caf2b |
Can you try to update Browserslist to 4.7.1 (double check that you updated all version by |
With 4.7.1 profiler still shows the same distribution. The change seems to store the parsed config for each parent folder, however reading the cache only looks at the current one. If CSS files are all in leaf folders, then the change didn't provide any improvement. While iterating the parents you should check the cache at every level, this should provide the needed optimization. |
Oops, I forgot about it. I will try to fix it today. |
I will try the change and if it works, send a PR |
The PR improves the situation, now it is 60%, instead of 70%. Still the |
A small optimization for |
Can you try this commit? I added cache for |
I will try it out tomorrow. |
Released in Browserslist 4.7.2. |
We use autoprefixer with a single .browserslistrc file in root. However, looking at profile trace for our webpack build, it shows that autoprefixer keeps reloading the file every time postcss plugin triggers. Overall it is not as much - 5 seconds total (out of 1 minute build) but for autoprefixer on its own browser list parsing takes >70% of the time.
The text was updated successfully, but these errors were encountered: