Skip to content

Extend Regex alternation source generator optimization to small sets #62438

Closed

Description

@stephentoub

In the Regex source generator, we special-case alternations where every branch begins with a different char, preferring to generate a switch statement, e.g. "abc|def" yields a switch statement with a case for 'a' and a case for 'd', as the implementation sees that all branches begin with a different character and thus there's no need to fall through from one case to the next, nor backtrack. However, we don't currently extend this to small sets, e.g. "[Aa]bc|[Dd]ef" could similarly benefit from a switch. This will be even more impactful now that IgnoreCase produces sets for all case-equivalent variations of a letter, e.g. "abc|def" under IgnoreCase producing the equivalent of "[Aa][Bb][Cc]|[Dd][Ee][Ff]".

Activity

  1. added this to the 7.0.0 milestone on Dec 6, 2021
  2. ghost added
    untriaged
    on Dec 6, 2021
  3. added
    help wanted
    and removed
    untriaged
    help wanted
    on Dec 6, 2021
  4. self-assigned this
    on Jan 13, 2022
  5. ghost added
    in-pr
    on Jan 13, 2022
  6. ghost removed
    in-pr
    on Jan 19, 2022
  7. ghost locked as resolved and limited conversation to collaborators on Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions