Skip to content

perf: optimize ProjectPath/ProjectTag detectors with dictionary lookups#55

Open
mfogliatto wants to merge 1 commit into
mainfrom
fix/issue-54
Open

perf: optimize ProjectPath/ProjectTag detectors with dictionary lookups#55
mfogliatto wants to merge 1 commit into
mainfrom
fix/issue-54

Conversation

@mfogliatto
Copy link
Copy Markdown
Owner

Summary

Optimizes GetViolationsFromExperimental() in ProjectPathViolationDetector and ProjectTagViolationDetector from O(rules × references) to O(n) using dictionary/HashSet lookups.

Changes

  • ProjectTagViolationDetector: Pre-filters rules matching current project tag, builds a Dictionary<string, rule> keyed by ToProjectTag for O(1) lookup per reference
  • ProjectPathViolationDetector: Pre-filters rules matching current project path prefix, then iterates references once against only the matching subset
  • Original GetViolationsFrom() preserved unchanged for backward compatibility

Fixes #54

…for O(n) complexity

Implements optimized GetViolationsFromExperimental() in both ProjectPathViolationDetector
and ProjectTagViolationDetector. For ProjectTag, uses a Dictionary<string, rule> for O(1)
lookup per reference. For ProjectPath, pre-filters matching rules to reduce inner iterations.

Fixes #54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Performance] O(rules × references) nested loop in GetViolationsFrom for ProjectPath/ProjectTag detectors

1 participant