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

[gatsby-plugin-sharp] Cache base64 calculations #6999

Closed
KyleAMathews opened this issue Aug 3, 2018 · 1 comment · Fixed by #9059
Closed

[gatsby-plugin-sharp] Cache base64 calculations #6999

KyleAMathews opened this issue Aug 3, 2018 · 1 comment · Fixed by #9059
Assignees

Comments

@KyleAMathews
Copy link
Contributor

Currently we memoize base64 resizes/calculations in

const memoizedBase64 = _.memoize(
but these are expensive to do so build speeds would also improve (for image heavy sites) by adding the calculated base64 strings to the cache. Because of how graphql invalidation works, we often need to re-run older graphql queries but the expensive parts of graphql queries can be cached ideally so when most parts of the query resolve the same, the whole query resolves very quickly.

I can't remember if gatsby-plugin-sharp has access to the global gatsby cache. If not, that needs fixed.

The cache key should be the file's contentDigest + the meaningful arguments e.g. cropFocus, image format, grayscale, etc.

@oorestisime
Copy link
Contributor

Hey, i would like to give this a go if nobody is touching this (mainly because i work on an image heavy site :) )

@oorestisime oorestisime self-assigned this Oct 2, 2018
@pieh pieh closed this as completed in #9059 Nov 6, 2018
pieh pushed a commit that referenced this issue Nov 6, 2018
Closes: #6999  
<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this issue Jan 22, 2019
Closes: gatsbyjs#6999  
<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
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 a pull request may close this issue.

3 participants