-
Notifications
You must be signed in to change notification settings - Fork 314
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(SpdxExpression): Fix the DNF algorithm #6721
Conversation
I'm using this scanner result to check the performance impact of this change: Results on my machineCurrent main: 13 seconds Therefore, the changes are currently not feasible :/ |
a5834b5
to
677c4d0
Compare
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #6721 +/- ##
=========================================
Coverage 64.82% 64.82%
Complexity 1938 1938
=========================================
Files 320 320
Lines 16024 16024
Branches 2281 2281
=========================================
Hits 10388 10388
Misses 4657 4657
Partials 979 979
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
70d48cf
to
7685fc2
Compare
Extracting the |
I guess you are right because according to Wikipedia the problem is np-complete: https://en.wikipedia.org/wiki/Quine%E2%80%93McCluskey_algorithm#Complexity (Cline-McCluskey calculates the minimal DNF which is not strictly required for our use case, but calculating a non-minimal DNF is probably not much less complex) I see basically two options how we can proceed:
|
Whenever a `SpdxExpression` contains an `AND` operator, the DNF needs to be calculated again. For instance, the correct DNF for `a AND (b OR c OR d)` is `(a AND b) OR (a AND c) OR (a AND d)`. Before, the calculated DNF for this expression was `(a AND (b OR c)) OR (a AND d)`, which is not a valid DNF. Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.com>
I wonder whether |
@MarcelBochtler what operation exactly did you perform on the result for benchmarking? |
I simply ran the evaluator using the linked ort evaluate -i scan-result.json -o ort/ --license-classifications-file license-classifications.yml --rules-file evaluator.rules.kts I cannot share the license-classifications and the evaluator rules.
Yes looks like it. Should I close this PR? |
For the sake of cleaning things up a little, I'd say yes. I believe in the context of the current code base there now nothing anymore in this PR that we could take / reuse. |
Whenever a
SpdxExpression
contains anAND
operator, the DNF needs to be calculated again.For instance the correct DNF for
a AND (b OR c OR d)
is(a AND b) OR (a AND c) OR (a AND d)
. Before, the calculated DNF for this expression was(a AND (b OR c)) OR (a AND d)
which is not a valid DNF.