Skip to content

Use StartsWith literal optimization for OrdinalIgnoreCase in RegexCompiler / source generator #66324

Closed
@stephentoub

Description

@stephentoub

#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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions