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
Cache module info getters before output generation #5438
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5438 +/- ##
=======================================
Coverage 98.80% 98.80%
=======================================
Files 236 237 +1
Lines 9423 9432 +9
Branches 2398 2398
=======================================
+ Hits 9310 9319 +9
Misses 48 48
Partials 65 65 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
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.
Looks good to me 👍
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.
I have taken the liberty to add the last change I proposed. From my side, this looks good now and we can merge and release it later today.
No problem and thanks! I didn't see your comment on mobile, but the change is fine by me too. |
This PR has been released as part of rollup@4.13.2. You can test it via |
This PR contains:
Are tests included?
Breaking Changes?
Description
According to
this.getModuleInfo
:After that, during the output generation phase, the props will no longer change and are stable. However, the internal implementation still keeps them as getters, so there's a cost later even if they don't change.
This PR implements caching for the getters after the build ends (or specifically at the start of output generation). This way accessing the module info will be fast.
Usage in the wild:
I was measuring the perf for https://github.com/withastro/docs, and with this PR, the Rollup build time dropped from 3m30s to 3m.
I'm not sure how to write a test for cache effectiveness, but I tested manually that the caching works. Existing tests should also pass.