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

Fix sort performance bug #418

Merged
merged 1 commit into from
Aug 20, 2024
Merged

Fix sort performance bug #418

merged 1 commit into from
Aug 20, 2024

Conversation

egibs
Copy link
Member

@egibs egibs commented Aug 20, 2024

Relates to #371

I noticed that our concurrent scan of the Keycloak package (~185,000) files was taking about 2-3 minutes longer with concurrency than it had originally without any concurrency.

I didn't catch this in the concurrency PR, but we're sorting the pathKeys slice each time results.Range iterates over the results map. This really adds up when scanning hundreds of thousands of files and explains why we didn't catch the bug in our current samples.

This PR sorts the pathKeys slice after we're done iterating and also removes the unnecessary anonymous function inside of the Range function.

Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs requested a review from tstromberg August 20, 2024 17:48
@egibs egibs changed the title Fix sort bug Fix sort performance bug Aug 20, 2024
@egibs egibs merged commit 940425b into chainguard-dev:main Aug 20, 2024
10 checks passed
@egibs egibs deleted the fix-sort-bug branch August 20, 2024 17:59
egibs added a commit to egibs/malcontent that referenced this pull request Sep 25, 2024
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
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