Reduce usage of Expression.Constant in RequestDelegateFactory
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
We can generate more efficient code by calling into static properties rather than using Expression.Constant.
- https://github.com/dotnet/aspnetcore/blob/f1ebd5d426a1996980eec00be55459352c6f27dc/src/Http/Http.Extensions/src/RequestDelegateFactory.cs#L321 - We should translate this into a call to a constructor `new ValueTask(EmptyResult.Instance)`.
- https://github.com/dotnet/aspnetcore/blob/f1ebd5d426a1996980eec00be55459352c6f27dc/src/Http/Http.Extensions/src/RequestDelegateFactory.cs#L860 - We should translate to this into a call to `CancellationToken.None`.
- https://github.com/dotnet/aspnetcore/blob/f1ebd5d426a1996980eec00be55459352c6f27dc/src/Http/Http.Extensions/src/RequestDelegateFactory.cs#L1289 - We should translate to this into a call to `CultureInfo.InvariantCulture.
- https://github.com/dotnet/aspnetcore/blob/f1ebd5d426a1996980eec00be55459352c6f27dc/src/Shared/ParameterBindingMethodCache.cs#L122 - We should generate the flags enum usage
- https://github.com/dotnet/aspnetcore/blob/f1ebd5d426a1996980eec00be55459352c6f27dc/src/Shared/ParameterBindingMethodCache.cs#L131 - Same as above.
Contributor guide
Assessment
This issue has not been assessed yet.