Expand description
Incremental diffing with result caching.
This module provides caching and incremental computation for SBOM diffs, dramatically improving performance when comparing related SBOMs (e.g., successive builds where only a few components change).
§How It Works
- Content Hashing: Each SBOM section (components, dependencies, licenses, vulnerabilities) has a separate content hash.
- Change Detection: Before recomputing, we check if each section changed.
- Partial Recomputation: Only sections that changed are recomputed.
- Result Caching: Full results are cached for exact SBOM pair matches.
§Performance Gains
- Exact cache hit: O(1) lookup
- Partial change: Only recompute changed sections (typically 10-50% of work)
- Cold start: Same as regular diff
Structs§
- Cache
Stats - Statistics for cache performance.
- Cached
Diff Result - A cached diff result with metadata.
- Changed
Sections - Indicates which sections changed between two SBOMs.
- Diff
Cache - Thread-safe cache for diff results.
- Diff
Cache Config - Configuration for the diff cache.
- Diff
Cache Key - Key for full diff cache lookup.
- Incremental
Diff Engine - A diff engine wrapper that supports incremental computation and caching.
- Incremental
Diff Result - Result of an incremental diff operation.
- Section
Hashes - Section-level hashes for incremental change detection.
Enums§
- Cache
HitType - Type of cache hit achieved.