-
Notifications
You must be signed in to change notification settings - Fork 520
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
perf: reduce _prerenderRoutes memory footprint #1529
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1529 +/- ##
=======================================
Coverage 76.25% 76.25%
=======================================
Files 73 73
Lines 7478 7481 +3
Branches 734 734
=======================================
+ Hits 5702 5705 +3
Misses 1775 1775
Partials 1 1
|
Nice! β€οΈ |
Great! <3 |
src/prerender.ts
Outdated
@@ -213,7 +215,11 @@ export async function prerender(nitro: Nitro) { | |||
); | |||
for (const _link of extractedLinks) { | |||
if (canPrerender(_link)) { | |||
routes.add(_link); | |||
if (_link.endsWith("_payload.json")) { |
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.
sorry but i cannot let this to be merged in nitro. please consider proposing framework agnostic solutions AND make sure there is a nitro minimal reproduction that makes sure it actually proves and solves an issue instead of hiding root causes.
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.
Requirements:
- Framework agnostic implementation
- Nitro minimal reproduction to make sure there is an issue with Nitro itself, not downstream framework (Nuxt) or modules.
As a Nuxt team member and nitro maintainer, I tend to fix the root cause of issues not patching them around.
Thanks for the feedback @pi0 I'm open to suggestions for a framework agnostic design. Edit @danielroe proposed a hook to do that, I'll refactor and open another PR |
(i am working on reproduction and alternative fix for content issue) @Hebilicious Can you please explain more why we would need to reorder prerender routes and how it relates to a possible fix? |
This re-ordering was based on this comment that included a nice heap profile. However with daniel suggestion, I now think its better to expose a hook (before For testing we could test the perf differences with nuxt/nuxt#22465 and #1529 and see how much re-ordering with payload routes first would impact things. |
Thanks for PR and explanations @Hebilicious and pin pointing the exact issue @danielroe i have made a better rework in #1536 which seems to fix (reproducable) issue. @Hebilicious I would recommend to try nuxt edge + nitro edge with both fixes (LRU cache and #1536) and rerun any previous benchmarks again to make sure sorting with fixes makes a difference. If it does, we already have |
π Linked issue
Related #1535
Related #1480
Related nuxt/nuxt#22449
β Type of change
π Description
Based on @simkuns patch. Internal
_prerenderedRoutes
now only contains route and fileName to reduce the memory footprintπ Checklist