Skip to content
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(content-list): cache contents list during generation and per-request #2527

Merged
merged 2 commits into from Jan 26, 2024

Conversation

farnabaz
Copy link
Member

@farnabaz farnabaz commented Jan 26, 2024

๐Ÿ”— Linked issue

resolves #2449

โ“ Type of change

  • ๐Ÿ“– Documentation (updates to the documentation or readme)
  • ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • ๐Ÿ‘Œ Enhancement (improving an existing functionality like performance)
  • โœจ New feature (a non-breaking change that adds functionality)
  • โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

The bottleneck in the pre-rendering phase is getting contents list from file system. By caching the list in the pre-render process, the generation time will drop significantly.

This change reduce the generation time in Content docs from 15s to 5s on my machine

๐Ÿ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@@ -38,6 +38,7 @@ export const cacheStorage: Storage = prefixStorage(useStorage(), 'cache:content'
export const cacheParsedStorage: Storage = prefixStorage(useStorage(), 'cache:content:parsed')

const isProduction = process.env.NODE_ENV === 'production'
const isPrerendering = process.argv?.includes('generate')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use import.meta.prerender

Copy link

cloudflare-pages bot commented Jan 26, 2024

Deploying with ย Cloudflare Pages ย Cloudflare Pages

Latest commit: 732edc1
Status:ย โœ…ย  Deploy successful!
Preview URL: https://77e5d7bd.nuxt-content-1il.pages.dev
Branch Preview URL: https://perf-cache-contents-list.nuxt-content-1il.pages.dev

View logs

@manlm
Copy link

manlm commented Feb 1, 2024

may i ask when will this be released

Copy link
Member

Atinux commented Feb 2, 2024

@manlm you can use the edge channel to use it today: https://content.nuxt.com/get-started/edge-channel

Release should be next week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prerender takes 10 minutes per page!!!
3 participants