Skip to content

Fold PathString aspnet pattern #84525

@EgorBo

Description

@EgorBo
private static readonly PathString _path = new PathString(Scenarios.GetPath(s => s.DbFortunesRaw));

public Task Invoke(HttpContext httpContext)
{
    if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
    {
        // ..
    }
}

It seems to be a popular pattern in aspnet benchmarks so ideally we should be able to unroll this StartsWithSegments since _path is static readonly thus we know the _path final length (e.g. _path.Value.Length; is already folded to a const in Tier1). It's possible that it can be done even today with a bit of C# massage in aspnet, but I'm not sure.

Needs #84524 first

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions