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

Memoize item headers to speed up export #3581

Merged
merged 1 commit into from
May 27, 2023
Merged

Memoize item headers to speed up export #3581

merged 1 commit into from
May 27, 2023

Conversation

dorner
Copy link
Collaborator

@dorner dorner commented May 12, 2023

The code was re-calculating item headers for each distribution by looping over each distribution (so O(n^2)). I memoized the results of this so this becomes O(n). The results come back in about 4 seconds instead of 4 minutes.

@dorner dorner requested a review from cielf May 12, 2023 20:49
@cielf
Copy link
Collaborator

cielf commented May 26, 2023

I somehow missed that you had requested me. Will look RSN.

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Looks good to me, and at least an order of magnitude faster! I'm wondering if we should do the same for purchase and donation, potentially request? Distributions is definitely the heaviest volume case, though, so there's benefit in getting it out there.

@cielf cielf merged commit 7319d81 into main May 27, 2023
@cielf cielf deleted the 3362-dist-slowdown branch May 27, 2023 01:07
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.

2 participants