Cache module info getters before output generation#5438
Merged
lukastaegert merged 7 commits intorollup:masterfrom Mar 28, 2024
Merged
Cache module info getters before output generation#5438lukastaegert merged 7 commits intorollup:masterfrom
lukastaegert merged 7 commits intorollup:masterfrom
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. |
TrickyPi
reviewed
Mar 22, 2024
Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
lukastaegert
approved these changes
Mar 28, 2024
Member
lukastaegert
left a comment
There was a problem hiding this comment.
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.
Contributor
Author
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.