C# makes heavy use of overload MemberExpression Property(Expression, MethodInfo) when generating expression trees using LINQ. For every invocation this method needs to loop through the properties of the type and compare the method against the property accessor methods, which can be expensive particularly on large types.
I suggest that System.Linq.Expressions.MemberExpression maintain a cache of resolved properties by MethodInfo. This would eliminate the cost of having to do the lookup every time the compiler is generating an expression tree over the same type/properties.
C# makes heavy use of overload
MemberExpression Property(Expression, MethodInfo)when generating expression trees using LINQ. For every invocation this method needs to loop through the properties of the type and compare the method against the property accessor methods, which can be expensive particularly on large types.I suggest that
System.Linq.Expressions.MemberExpressionmaintain a cache of resolved properties byMethodInfo. This would eliminate the cost of having to do the lookup every time the compiler is generating an expression tree over the same type/properties.