Skip to content

[Perf] consider not using Expression.Invoke in CreateGetValueExpression for value with converter when possible #35129

@maumar

Description

@maumar

We made a change (needed for AOT) to how we compute CreateGetValueExpression for properties with converter. Before AOT we would just incorporate ConvertFromProviderExpression into the shaper, but that expression may contain constants we can't construct in the precompiled query. So instead, we find the converter from the model (IF we have the IProperty), get ConvertFromProviderExpression lambda and use Expression.Invoke to call it dynamically. This works fine, but is slow.

Instead, we could consider peeking into the ConvertFromProviderExpression in compile time, and if it doesn't contain any problematic constants, inline the expression to avoid Invoke (like we used to do in pre-AOT days), and only resort to that if we must.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions