Skip to content

Check for a set instance only before an MA0002 report - #1622

Merged
meziantou merged 1 commit into
meziantou:mainfrom
alexander-efremov:perf/ma0002-defer-set-check
Oct 3, 2026
Merged

meziantou merged 1 commit into
meziantou:mainfrom
alexander-efremov:perf/ma0002-defer-set-check

Conversation

@alexander-efremov

Copy link
Copy Markdown
Contributor

What

MA0002 skips calls on sets. To find out whether the instance is a set, it ran a data flow analysis of the instance of every invocation, up to three times. It now runs it once, and only for a call it would report.

Why

Meziantou.Analyzer time on one large test project: 11.6 s before, 6.4 s after.

Tests

  • a set held in a local of an interface type: no diagnostic
  • a list held in the same way: diagnostic and fix

Existing tests pass on Roslyn 5.9 and 4.8.

MA0002 ran a data flow analysis of the instance of every invocation, up to
three times, to skip calls on sets. It now runs it once, only for a call
it would report.
@meziantou
meziantou merged commit b4317be into meziantou:main Oct 3, 2026
14 checks passed
@alexander-efremov
alexander-efremov deleted the perf/ma0002-defer-set-check branch October 4, 2026 03:44
This was referenced Oct 5, 2026
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.

2 participants