-
Notifications
You must be signed in to change notification settings - Fork 10.3k
feat(gatsby-plugin-sharp): cache image metadata #35791
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
Conversation
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.
Nice!
Thanks! I'll investigate what's going on with the development runtime tests and see if I can reproduce locally |
The development/production have some flaky tests, I've restarted them and let's see |
They failed when I opened the PR which I assumed was flakiness, but failed again today when @pieh restarted them, so I think it may be real |
They're all failing on |
Yeah, |
Aha. Another PR failing with the same test. Must be unrelated. |
But in https://app.circleci.com/pipelines/github/gatsbyjs/gatsby/82992/workflows/a0fe5b63-96e0-491f-ae20-9b68f4732e5d/jobs/988774 the |
Hah. Jinx. OK, so should this wait til that fix lands? |
Hmm. I don't understand what's happening with that one: https://dashboard.cypress.io/projects/5k8zbj/runs/641/overview/ee804400-e764-4d86-a9a5-362aae24bdab |
I've pushed another commit with that |
Published at |
I have another optimisation coming in shortly |
Description
Caches image metadata between builds
Documentation
Currently gatsby-plugin-sharp uses an in-memory cache to store image metadata during a build, but it is not persisted between builds. This means that the relatively expensive dominant color calculations need to be re-done each time. This PR switches to use the
GatsbyCache
if it is available, falling back to the in-memory cache otherwise. In my tests, this saved over a minute for warm-cache builds of a site with 100 images.Related Issues