-
Notifications
You must be signed in to change notification settings - Fork 36
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
Preload method with benchmarks #14
Conversation
Fixes #13 - added preload method to initialize database without performing any license check. Added two benchmarks to compare the difference between calls with and without preload.
Benchmark results on my laptop:
|
@bzz could you please check this PR? |
@bzz hi, any chance to review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sans a minor API doc clarification.
Windows test failures have nothing to do with the change.
Thank you for adding this!
licensedb/licensedb.go
Outdated
@@ -53,3 +53,8 @@ func Detect(fs filer.Filer) (map[string]api.Match, error) { | |||
} | |||
return licenses, nil | |||
} | |||
|
|||
// Preload database with licenses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it extends the API surface, IMO it would be nice to add a few words here to clarify the contract - that it is an optimization and the client does need to call this first, as the rest of the APIs are doing that lazily anyway, or some words to that effect.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will fix that
Fixes #13 - added preload method to initialize database without
performing any license check. Added two benchmarks to compare
the difference between calls with and without preload.