You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
When having a few thousand markdown pages (2,000+), navigating between markdown pages when running the dev server can take seconds to load the new page.
(I observed multiple seconds on an Intel MacBook Pro and 1~2 seconds on a M1 Pro MacBook Pro per page transition.)
This problem explicitly occurs on the local dev server, for markdown pages only, and only when having 2,000+ markdown pages, making local development quite frustrating.
Build times are fine though and navigating on the SSR generated site is snappy.
Describe the solution you'd like
The problem seems to be caused by not using the content cache on localhost.
I assume not using the cache keeps hot reload working when files are changed, however this seems to cause the severe degradation in performance when dealing with lots of markdown pages.
To fix the issue I suggest using the cache on localhost as well, and flushing the cache when a file change is detected, to keep hot reload working.
I will create a PR (draft) later to address this.
Describe alternatives you've considered
N/A
Additional context
Video showing the issue:
Screen.Recording.2024-06-21.at.18.34.56.mov
On the video loading times are still < 1s, however the situation gets worse for more complex markdown pages.
Is your feature request related to a problem? Please describe
When having a few thousand markdown pages (2,000+), navigating between markdown pages when running the dev server can take seconds to load the new page.
(I observed multiple seconds on an Intel MacBook Pro and 1~2 seconds on a M1 Pro MacBook Pro per page transition.)
This problem explicitly occurs on the local dev server, for markdown pages only, and only when having 2,000+ markdown pages, making local development quite frustrating.
Build times are fine though and navigating on the SSR generated site is snappy.
Describe the solution you'd like
The problem seems to be caused by not using the content cache on localhost.
content/src/runtime/server/storage.ts
Lines 147 to 149 in 3a2b5d1
I assume not using the cache keeps hot reload working when files are changed, however this seems to cause the severe degradation in performance when dealing with lots of markdown pages.
To fix the issue I suggest using the cache on localhost as well, and flushing the cache when a file change is detected, to keep hot reload working.
I will create a PR (draft) later to address this.
Describe alternatives you've considered
N/A
Additional context
Video showing the issue:
Screen.Recording.2024-06-21.at.18.34.56.mov
On the video loading times are still < 1s, however the situation gets worse for more complex markdown pages.
Video showing the fix I'm working on:
Screen.Recording.2024-06-21.at.18.40.47.mov
Reproduction
I've created a project on StackBlitz to reproduce the issue.
https://stackblitz.com/~/github.com/coffeephile/nuxt-huge-project-test
nuxt-content-performance-patch
npm i
NUXT_NUM_PAGES=10000 npm run dev
(generate 10,000 markdown pages)To apply the fix:
chmod +x patch-content-localhost.sh
./patch-content-localhost.sh
NUXT_NUM_PAGES=10000 npm run dev
The text was updated successfully, but these errors were encountered: