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(gatsby-source-contentful): change O(n*m) loop to O(n+m) #27448

Merged
merged 1 commit into from
Oct 15, 2020

Conversation

pvdz
Copy link
Contributor

@pvdz pvdz commented Oct 14, 2020

Had a case where this function was called with n=96 m=73529 . The old code would 96x filter the list of 73k elements. The new code buckets it once.

Before it would take 650ms, after it takes 31ms. Not a major win in absolute time but massive win in relative perf.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 14, 2020
@pvdz pvdz requested a review from axe312ger October 14, 2020 13:51
@pvdz pvdz added topic: source-contentful Related to Gatsby's integration with Contentful topic: performance Related to runtime & build performance topic: scaling builds and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Oct 14, 2020
Copy link
Collaborator

@axe312ger axe312ger left a comment

Choose a reason for hiding this comment

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

Took me a moment to get but thanks, great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: performance Related to runtime & build performance topic: source-contentful Related to Gatsby's integration with Contentful
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants