Use StartsWith literal optimization for OrdinalIgnoreCase in RegexCompiler / source generator #66324
Labels
area-System.Text.RegularExpressions
tenet-performance
Performance related issue
untriaged
New issue has not been triaged by the area owner
Milestone
#66095 is optimizing MemoryExtensions.StartsWith(span, "literal", OrdinalIgnoreCase) by auto-vectorizing cases where the literal string is all ASCII. In Regex, we can take advantage of this in the compiler and source generator by recognizing sequences of appropriate sets, e.g.
"[Aa][Bb][Cc]"
, which our IgnoreCase option now produces (and will produce more robustly with #61048). Today we'll output individual checks for each set, e.g.(ch | 0x20) == 'a'
, but we can start outputting StartsWith calls with the corresponding multi-character literal string rather than performing individual comparisons against each char.cc: @EgorBo, @joperezr
The text was updated successfully, but these errors were encountered: