dotnet / dotnet/aspnetcore

Reduce usage of Expression.Constant in RequestDelegateFactory

Open
#41,435 4 comments 1 reaction 0 assignees View on GitHub
area-minimal Perf
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

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.