Skip to content

perf: optimize incremental generator performance - #11

Merged
Skymly merged 1 commit into
masterfrom
feature/optimize-incremental-pipeline
May 16, 2026
Merged

perf: optimize incremental generator performance#11
Skymly merged 1 commit into
masterfrom
feature/optimize-incremental-pipeline

Conversation

@Skymly

@Skymly Skymly commented May 16, 2026

Copy link
Copy Markdown
Member

Part of #11

Summary

Incremental performance improvements for the ObservableEvents generator.

Changes

  • Add ObservableEventTargetSets.Empty singleton to avoid repeated empty array allocations
  • Cache Avalonia type metadata lookups (RoutedEvent and non-generic) to avoid repeated GetTypeByMetadataName calls
  • Use static readonly field for common empty return path when bootstrap type is not found

Performance Impact

  • Reduces allocations for projects not using Avalonia (cached detection)
  • Faster empty path when bootstrap extensions are not referenced
  • Minor CPU reduction for large candidate sets

Tests

  • All 14 tests pass
  • No functional changes

- Add ObservableEventTargetSets.Empty singleton to avoid allocations
- Cache Avalonia type metadata lookups to avoid repeated calls
- Use static readonly Empty field for common empty return path
- Minor code cleanup with comments for clarity

Part of #11
@Skymly
Skymly merged commit d2e1df3 into master May 16, 2026
1 check passed
@Skymly
Skymly deleted the feature/optimize-incremental-pipeline branch May 16, 2026 16:20
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.

1 participant