Using spans to optimize the slicing case
This commit is contained in:
parent
55fea7976c
commit
ba875bffcd
|
|
@ -62,6 +62,12 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers
|
||||||
output.Write(value, startIndex, characterCount);
|
output.Write(value, startIndex, characterCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Encode(TextWriter output, string value, int startIndex, int characterCount)
|
||||||
|
{
|
||||||
|
var span = value.AsSpan();
|
||||||
|
output.Write(span.Slice(startIndex, characterCount));
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public override unsafe int FindFirstCharacterToEncode(char* text, int textLength)
|
public override unsafe int FindFirstCharacterToEncode(char* text, int textLength)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue