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
It seems to be a popular pattern in aspnet benchmarks so ideally we should be able to unroll this
StartsWithSegmentssince_pathisstatic readonlythus 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