-
Notifications
You must be signed in to change notification settings - Fork 11
benchmark tests for validating MIT license #132
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
base: main
Are you sure you want to change the base?
Conversation
Two benchmarks were added:
1) `spdxexp.ValidateLicenses([]string{"MIT”})`
2) `”MIT” == “MIT”`
NOTE: The array `[]string{"MIT”})` is created outside the benchmark loop to avoid it contributing to the benchmark time.
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.
Pull request overview
This PR adds Go benchmarks to measure and compare the performance and allocation behavior of SPDX license validation for a simple MIT license against a baseline string equality check.
Changes:
- Added
BenchmarkValidateLicensesMITto benchmarkspdxexp.ValidateLicenses([]string{"MIT"}), with the license slice allocated outside the benchmark loop and allocations reported. - Added
BenchmarkStringEqualityMITas a control benchmark that measures the cost of a simple"MIT" == "MIT"comparison with allocation reporting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The benchmark and summary will allow us to quantify changes to the algorithm to help us work to a more efficient and scalable evaluation process.
|
Results: |
Benchmarks were added to test efficiency of several ways to test that a license is a valid SPDX license:
spdxexp.ValidateLicenses([]string{"MIT”})spdxexp.ActiveLicense("MIT")”MIT” == “MIT”NOTE: The array
[]string{"MIT”})is created outside the benchmark loop to avoid it contributing to the benchmark time.