Skip to content

Proposal: Add Caching to Expression.Property by MethodInfo #2011

Description

@HaloFour

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions