This repository was archived by the owner on Jan 23, 2023. It is now read-only.
[release/3.1] Port dotnet/runtime#31904 fix for slow UTF-8 transcoding performance #28013
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue dotnet/runtime#2251 reports that on AMD processors, we severely regressed some UTF-8 transcoding code paths on AMD processors. These processors have unoptimized implementations of the
pdep
/pext
intrinsic. We didn't see this earlier because my benchmarking machine uses an Intel processor.This has already been fixed in .NET 5 (see dotnet/runtime#31904). This PR ports that fix down to release/3.1.
Customer Impact
Significant slowdowns in UTF-8 transcoding performance on 3.0 compared to 2.1 when using an AMD processor and where the input to transcode has mixed ASCII and non-ASCII data.
Regression?
Perf regression between 2.1 and 3.0. Not a functional regression.
Testing
Fix has been perf tested (see dotnet/runtime#31904 (comment)) and fuzzed (see dotnet/runtime#31904 (comment)).
Risk
Low. No functional changes; only performance changes. We have excellent unit test coverage and fuzzer coverage over this code.
Code Reviewer
@tannergooding