Skip to content

Simplify generated code check in AccessAnalyzer#6581

Open
Tayrtahn wants to merge 1 commit into
space-wizards:masterfrom
Tayrtahn:perf/access-analyzer-generated
Open

Simplify generated code check in AccessAnalyzer#6581
Tayrtahn wants to merge 1 commit into
space-wizards:masterfrom
Tayrtahn:perf/access-analyzer-generated

Conversation

@Tayrtahn
Copy link
Copy Markdown
Member

@Tayrtahn Tayrtahn commented May 19, 2026

AccessAnalyzer currently handles auto-generated code by examining the generated files normally and doing an attribute lookup on every access attempt within them to check for the RobustAutoGeneratedAttribute. This is slow and relies on all generated code remembering to apply the attribute.

Instead of doing all that, this PR changes the GeneratedCodeAnalysisFlags to None instead of Analyze | ReportDiagnostics.

On my machine, this reduced the execution time of AccessAnalyzer when packaging Content.Server from ~3.5 seconds (the slowest of our analyzers) to ~0.5 seconds.

@Tayrtahn Tayrtahn added T: Performance Type: Performance problem or optimization A: Roslyn Components Roslyn analyzers, source generators, code fixes labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: Roslyn Components Roslyn analyzers, source generators, code fixes T: Performance Type: Performance problem or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant