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: use a map to track which advisories should be checked for which packages #216

Merged
merged 4 commits into from Sep 14, 2023

Conversation

G-Rath
Copy link
Owner

@G-Rath G-Rath commented Sep 13, 2023

This greatly improves the performance of determining vulnerabilities since now only advisories that actually could match a package are checked, rather than looping through all of them for all packages which scales much better as the number of advisories in a database grows.

You can easily see the difference in speed by just running make regenerate-e2e-fixtures - before this change it typically takes 30 seconds whereas after it takes only 10.

This also means that the detector no longer loads advisories without any affected packages, which really shouldn't change anything but lets us easily stop using the Vulnerabilities function reducing the size by a couple of KB - I've kept the function because its still used in tests and doesn't have to be removed so this is less breaking.

@G-Rath G-Rath merged commit 2e92110 into main Sep 14, 2023
8 checks passed
@G-Rath G-Rath deleted the use-a-map branch September 14, 2023 02:01
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.

None yet

1 participant