- 
                Notifications
    You must be signed in to change notification settings 
- Fork 285
Open
Description
Per the magic decoder ring at dotnet/runtime#41699 (comment), some of the tests in Perf.Utf8Encoding.cs may be testing too many concepts, which can complicate finding regressions.
I'd recommend reworking this file so that it contains a total of six tests:
- A test which calls Encoding.UTF8.GetByteCount(string), which exercises onlyUtf16Utility.GetPointerToFirstInvalidChar(validation).
- A test which calls Encoding.UTF8.GetCharCount(byte[]), which exercises onlyUtf8Utility.GetPointerToFirstInvalidByte(validation).
- A test which calls Encoding.UTF8.GetChars(ROS<byte>, Span<char>), which exercises onlyUtf8Utility.TranscodeToUtf16(transcoding).
- A test which calls Encoding.UTF8.GetBytes(ROS<char>, Span<byte>), which exercises onlyUtf8Utility.TranscodeToUtf8(transcoding).
- A test which calls Encoding.UTF8.GetBytes(string); which exercises validation, byte array instantiation, and transcoding.
- A test which calls Encoding.UTF8.GetString(byte[]), which exercises validation, string instantiation, and transcoding.
For each of these tests, we should use Encoding.UTF8.Xyz, allowing the JIT's full devirtualization features to kick in.
/cc @adamsitnik @jeffhandley @kunalspathak @carlossanlop @pgovind @tannergooding
kunalspathak and carlossanlop
Metadata
Metadata
Assignees
Labels
No labels