Repository navigation
perf: cache dependency refs to skip redundant registration in validate() - #1033
saquibsaifee wants to merge 5 commits into
Conversation
|
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 7 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Documentation build overview
13 files changed ·
|
|
@jkowalleck can you take a look at this PR to boost SBOM generation turn around |
Signed-off-by: saquibsaifee <saquibsaifee2@gmail.com>
6f5dc72 to
e05bb2f
Compare
|
Need to look into this again, might not be adding any performance improvement at all |
…n validate() Signed-off-by: Saquib Saifee <66195765+saquibsaifee@users.noreply.github.com>
|
@jkowalleck, this PR is ready for review. |
There was a problem hiding this comment.
Tested test_model_bom and JSON/XML v1.6 serialization across this branch and #1007 (which also addresses #1006). Both produce identical output and reduce BomRef.__eq__ calls in validate() at N = 4000 from 8,051,885 to 49,884. Reading self._dependencies directly in Step 0 and keeping set(chain(...)) in Step 1 avoids per-iteration loop overhead (162 ms vs 176 ms). The added component and service shared bom_ref test is useful coverage either way.
Description
Optimizes$O(N^2)$ to $O(N \log N)$ by eliminating redundant linear scans over $O(1)$ .
Bom.validate()fromself.dependencieswhen ensuring dependable elements are registered, directly adding missing entries while tracking seen references inChanges:
_dependencieswith active set tracking, eliminating repeated linear filter scans over the dependency collection.Affirmation