Skip to content

perf: make StaticPropertyInitializationGenerator incremental - #4638

Merged
thomhurst merged 1 commit into
thomhurst:mainfrom
TimothyMakkison:static_prop_generator_incre
Feb 6, 2026
Merged

perf: make StaticPropertyInitializationGenerator incremental#4638
thomhurst merged 1 commit into
thomhurst:mainfrom
TimothyMakkison:static_prop_generator_incre

Conversation

@TimothyMakkison

Copy link
Copy Markdown
Contributor
  • Add PropertyWithDataSourceModel and associated types
  • Return ImmutableArray<PropertyWithDataSource> from GetSemanticTargetForGeneration
  • Move enabledProvider check to earlier in pipeline to reduce work
  • ToUniquePropertyModels ensures that only distinct properties are converter into PropertyWithDataSourceModel
  • Only call GetStaticPropertyDataSources instead of doing a unnecessary call in GenerateStaticPropertyInitialization

@TimothyMakkison

TimothyMakkison commented Feb 3, 2026

Copy link
Copy Markdown
ContributorAuthor
  • Fixed run length assertion in AotConverterTests
  • Refactor and rename methods in the parse step
  • Use a reusable properties list and keep track of already visited nodes
  • Add tests to ensure that the generator is incremental
MethodMeanErrorStdDevGen0Allocated
RunGenerator20.42 ms0.354 ms0.562 ms250.00002.38 MB

Time and memory usage seems suspiciously low 🤔 but the tests appear to pass

@TimothyMakkison
TimothyMakkison marked this pull request as ready for review February 3, 2026 21:50
@TimothyMakkison
TimothyMakkisonforce-pushed the static_prop_generator_incre branch 2 times, most recently from 486c58e to 4ccfdb3CompareFebruary 5, 2026 00:26
@claude

claudeBot commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

This is a well-structured performance optimization that properly implements incremental source generation patterns. The separation of parsing and generation phases, introduction of value-based model types, and proper use of EquatableArray all follow Roslyn best practices for incremental generators.

Sign up for freeto 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

@TimothyMakkison@thomhurst