Skip to content

fix: cache project tag lookups to avoid redundant XML parsing#52

Open
mfogliatto wants to merge 2 commits into
mainfrom
fix/issue-51
Open

fix: cache project tag lookups to avoid redundant XML parsing#52
mfogliatto wants to merge 2 commits into
mainfrom
fix/issue-51

Conversation

@mfogliatto
Copy link
Copy Markdown
Owner

Summary

Caches the result of ProjectTagProvider.GetProjectTag() using a ConcurrentDictionary, so each project file is read and parsed at most once per analyzer lifetime instead of once per rule × reference combination.

Changes

  • Added ConcurrentDictionary<string, string> cache to ProjectTagProvider
  • Replaced direct file I/O with _cache.GetOrAdd() call
  • Added System.Collections.Concurrent using directive

Testing

No dotnet SDK available in CI environment; change is minimal and mechanical. Existing tests should pass unchanged since behavior is identical (same inputs → same outputs, just cached).

Fixes #51

- Replace target-typed new() with explicit ConcurrentDictionary<string, string>()
- Rename _cache to cache (SA1309)
- Add this. prefix to field access (SA1101)
- Ensure space after new keyword (SA1000)
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] ProjectTagViolationDetector reads and parses XML file for every reference × rule combination

1 participant