Uh oh!
There was an error while loading. Please reload this page.
SIMDify ToLowerInvariant/ToUpperInvariant - #78262
Conversation
ghost
commented
Nov 12, 2022
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
stephentoub
commented
Nov 12, 2022
What's the overhead when non-ASCII is encountered? |
…I chars as we can before we switch to ICU/NLS
EgorBo
commented
Nov 13, 2022
The worst case for this algorithm is a short (>7 chars) full non-ASCII string, but the cost of SIMD "is ascii" check is not too big. publicIEnumerable<string>TestData(){// worst case: short full non-ASCIIyieldreturn"Привет Мир";yieldreturn"ASCII-string with non-ASCII chars: ыц!";}privatestaticreadonlychar[]OutputBuffer=newchar[1024];[Benchmark][ArgumentsSource(nameof(TestData))]publicvoidToLowerInvariant(stringstr)=>str.AsSpan().ToLowerInvariant(OutputBuffer.AsSpan());
I've pushed a change to call the Scalar path if we encounter non-ASCII in a vector - because we still want to process as many ASCII chars as we can before we switch to extremely slow NLS/ICU fallback. |
This PR does:
ToUpperInvariant()shows the same numbers.