-
Notifications
You must be signed in to change notification settings - Fork 594
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
LoadVulnerabilityDB could be faster with ValidateByHashOnGet #1502
Comments
Hi @jonjohnsonjr, thank you for the report and sorry it's taken us a while to get back to you! We will put this in the backlog to look at as soon as we are able. We would also be happy to review a pull request if you had a chance to work on it. Thanks again. |
Starting to hit this, too — I'm finding that it takes at least ~1.6s to run just the I don't mind opening a PR, but I'm curious what's allowed to change about what this function does, since it's juggling a few different things at once |
I’ve opened a PR to address this issue #2054 Any feedback or suggestions would be appreciated. Thanks! |
What happened:
Calling
LoadVulnerabilityDB
withValidateByHashOnGet
set to true ends up hashing the DB twice.What you expected to happen:
We would hash the DB once.
How to reproduce it (as minimally and precisely as possible):
Then run grype. It is slower than you would expect because it's hashing the DB twice:
Anything else we need to know?:
This ends up hashing the whole DB:
grype/grype/load_vulnerability_db.go
Lines 23 to 26 in b81340c
This also ends up hashing the whole DB:
grype/grype/load_vulnerability_db.go
Line 28 in b81340c
Also, this could probably be even faster if
HashFile
usedio.CopyBuffer
or abufio.Reader
with a larger buffer than the default used byio.Copy
.Since we are calling
LoadVulnerabilityDB
as a library, we are probably hitting this where nobody else would (via thegrype
cli), and we don't even look at theStatus
that gets returned, so perhaps we should just reimplement whatLoadVulnerabilityDB
is doing, but figured it would be good to file an issue.Environment:
grype version
:cat /etc/os-release
or similar):The text was updated successfully, but these errors were encountered: