-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
improve sourcemap performance #1881
improve sourcemap performance #1881
Conversation
lib/map-generator.js
Outdated
this.memoizedFileURLs = new Map(); | ||
this.memoizedPaths = new Map(); | ||
this.memoizedURLs = new Map(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specific operations were done very frequently and were slow.
As far as I can tell these can be memoized.
This dramatically improves performance of sourcemap generation.
I don't have a strong opinion on naming or best practices here.
Please advice if there is a more idiomatic way to memoize these values within PostCSS.
Can you show the benchmark results (before/after) on you machine? |
On my machine (M2 air) :
|
lib/map-generator.js
Outdated
file = relative(from, file) | ||
return file | ||
let path = relative(from, file) | ||
this.memoizedPaths.set(file, path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;
Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
Looks amazing. I will accept it tomorrow. Don’t want to accept and release before going to bed :D. |
Thanks. Released in 8.4.30. |
Awesome! thank you 🙇 |
related change to PostCSS benchmarks : postcss/benchmark#32