Remove MakeGenericMethod from the query hot path
Open
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
Assessment
This issue has not been assessed yet.