Skip to content

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

Closed

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

Activity

  1. added this to the 7.0.0 milestone on Mar 8, 2022
  2. self-assigned this
    on Mar 8, 2022
  3. ghost added
    untriaged
    on Mar 8, 2022
  4. ghost added
    in-pr
    on Mar 8, 2022
  5. ghost removed
    in-pr
    on Mar 10, 2022
  6. ghost locked as resolved and limited conversation to collaborators on Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-System.Text.RegularExpressionstenet-performanceuntriaged

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions