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

[DRAFT] getCollection perf improvements when called multiple times #2816

Closed
wants to merge 4 commits into from

Conversation

bholmesdev
Copy link
Contributor

What kind of changes does this PR include?

  • Changes to the docs site code

Description

@delucis Found that calling getCollection('docs') in multiple places noticeably slowed builds over centralizing to a since getCollection() call. This branch experiments with a caching layer in core for prod builds to get the same benefits.

@netlify
Copy link

netlify bot commented Mar 9, 2023

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 448fa81
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/640a2e181ffe1b0008b17e09
😎 Deploy Preview https://deploy-preview-2816--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Ooh, very interesting! Looks like it’s working right?

Funnily enough, I’ve actually really enjoyed the import { pages } from '~/content' pattern we were pushed into, but happy to see we might be able to help ensure that performance for everyone, without them needing to hunt for that optimisation. Thanks Ben 💜

@sarah11918 sarah11918 added the site improvement Some thing that improves the website functionality - ask @delucis for help! label Mar 9, 2023
@bholmesdev
Copy link
Contributor Author

@delucis totally! I don't plan to merge this PR, just using it to test build times in CI. Seems to replicate the ~10% reduction in build times I've been seeing locally 😄

Also happy to report there's no noticeable increase in memory usage when adding this cache. Feeling confident we can open a core PR for this. Thanks for exploring this during the migration so we could improve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site improvement Some thing that improves the website functionality - ask @delucis for help!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants