Commit 900a423
authored
refactor: reduce PropertyInjector complexity and allocations (#4931)
- Cache PropertyInfo lookups via static ConcurrentDictionary to avoid
repeated reflection calls in source-gen paths
- Extract InjectPropertiesFromPlanAsync and RecurseIntoPropertyValueAsync
to reduce cyclomatic complexity of InjectPropertiesRecursiveAsync
- Extract CreateSourceGeneratedDataGeneratorMetadata to fix duplicate
PropertyHelper.GetPropertyInfo call (was called twice per property)
- Extract RentVisitedDictionary/ReturnVisitedDictionary for pool ops
- Use PropertyInitializationContext factory methods instead of manual
object initializers, reducing duplication across 4 call sites
- Replace foreach with indexed for loops to avoid enumerator allocations
- Simplify GetInitializedDataSourceAsync with null-coalescing operator
- Remove redundant condition checks where HasProperties already implies
properties exist
- Convert ResolveAndCachePropertiesCoreAsync from async to synchronous
Task return to avoid unnecessary state machine allocation
Closes #48971 parent 2e7e85a commit 900a423
1 file changed
Lines changed: 171 additions & 170 deletions
0 commit comments