You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the recent custom encoder work, it was found that the existing System.Text.Encodings.Web.TextEncoder class does not have an overload of an "Encode" method taking a ReadOnlySpan<char>. The causes a perf hit because the callers (System.Text.Json's writer and serializer) must convert utf16->utf8 (in order to call EncodeUtf8)->utf16.
Proposed API:
namespaceSystem.Text.Encodings.Web{publicclassTextEncoder// existing class{// Existing method as a reference:publicvirtualOperationStatusEncodeUtf8(ReadOnlySpan<byte>utf8Source,Span<byte>utf8Destination,outintbytesConsumed,outintbytesWritten,boolisFinalBlock=true);// Proposed method:publicvirtualOperationStatusEncode(ReadOnlySpan<char>source,Span<char>destination,outintcharsConsumed,outintcharsWritten,boolisFinalBlock=true);}}
In addition, there may be some overrides of this new virtual method on derived classes pending discussion\implementation.
With the recent custom encoder work, it was found that the existing
System.Text.Encodings.Web.TextEncoder
class does not have an overload of an "Encode" method taking aReadOnlySpan<char>
. The causes a perf hit because the callers (System.Text.Json's writer and serializer) must convert utf16->utf8 (in order to call EncodeUtf8)->utf16.Proposed API:
In addition, there may be some overrides of this new virtual method on derived classes pending discussion\implementation.
cc @GrabYourPitchforks @ahsonkhan
(Method signatures edited by @GrabYourPitchforks on Jul. 16, 2019.)
The text was updated successfully, but these errors were encountered: