dotnet / dotnet/efcore

Remove MakeGenericMethod from the query hot path

Open
#27,437 1 comment 0 reactions 1 assignee Claimed by @AndriySvyryd View on GitHub
area-aot area-perf area-query
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

When calling terminating operators such as Single, Average, [we currently call MakeGenericMethod](https://github.com/dotnet/efcore/blob/main/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs#L3076), which is slow; when running a basic tracking query + update against InMemory, this (and the related GetGenericArguments) take up around 0.6% of the running time with Npgsql, around 6% with InMemory.

We could probably follow [the runtime's pattern](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.cs#L772) to get rid of this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.