@@ -8,8 +8,8 @@ namespace EntityFrameworkCore.Projectables.Benchmarks
88{
99 /// <summary>
1010 /// Micro-benchmarks <see cref="ProjectionExpressionResolver.FindGeneratedExpression"/> in
11- /// isolation (no EF Core overhead) to directly compare the registry lookup path against
12- /// the previous per-call reflection chain .
11+ /// isolation (no EF Core overhead) to directly compare the static registry path against
12+ /// the reflection-based path (<see cref="ProjectionExpressionResolver.FindGeneratedExpressionViaReflection"/>) .
1313 /// </summary>
1414 [ MemoryDiagnoser ]
1515 public class ExpressionResolverBenchmark
@@ -25,16 +25,32 @@ public class ExpressionResolverBenchmark
2525
2626 private readonly ProjectionExpressionResolver _resolver = new ( ) ;
2727
28+ // ── Registry (source-generated) path ─────────────────────────────────
29+
2830 [ Benchmark ( Baseline = true ) ]
29- public LambdaExpression ? ResolveProperty ( )
31+ public LambdaExpression ? ResolveProperty_Registry ( )
3032 => _resolver . FindGeneratedExpression ( _propertyMember ) ;
3133
3234 [ Benchmark ]
33- public LambdaExpression ? ResolveMethod ( )
35+ public LambdaExpression ? ResolveMethod_Registry ( )
3436 => _resolver . FindGeneratedExpression ( _methodMember ) ;
3537
3638 [ Benchmark ]
37- public LambdaExpression ? ResolveMethodWithParam ( )
39+ public LambdaExpression ? ResolveMethodWithParam_Registry ( )
3840 => _resolver . FindGeneratedExpression ( _methodWithParamMember ) ;
41+
42+ // ── Reflection path ───────────────────────────────────────────────────
43+
44+ [ Benchmark ]
45+ public LambdaExpression ? ResolveProperty_Reflection ( )
46+ => ProjectionExpressionResolver . FindGeneratedExpressionViaReflection ( _propertyMember ) ;
47+
48+ [ Benchmark ]
49+ public LambdaExpression ? ResolveMethod_Reflection ( )
50+ => ProjectionExpressionResolver . FindGeneratedExpressionViaReflection ( _methodMember ) ;
51+
52+ [ Benchmark ]
53+ public LambdaExpression ? ResolveMethodWithParam_Reflection ( )
54+ => ProjectionExpressionResolver . FindGeneratedExpressionViaReflection ( _methodWithParamMember ) ;
3955 }
4056}
0 commit comments