Skip to content

Optimize case_fold_and_combine_ranges? #79

Closed

Description

@SimonSapin

I haven’t timed it, but the case_fold_and_combine_ranges function introduced in #78 is probably slow for large sets of character ranges like \p{Lu}. (That is, slow to parse/compile a regex.) It can probably be improved to not consider individual chars when we can determine that none in a given range (or subrange) is affected by case folding.

Activity

  1. BurntSushi commented on Apr 19, 2015

    @BurntSushi
    Member

    Yeah, I saw that. I'm not terribly concerned with parsing/compiling performance. I'll take a pass over it in my parser rewrite. (Which I'm doing as part of #29.)

  2. BurntSushi commented on Apr 26, 2015

    @BurntSushi
    Member
  3. SimonSapin commented on Apr 26, 2015

    @SimonSapin
    ContributorAuthor

    Nice! I feel it could be more clever still, but this seems to be a nice compromise of optimizing some (most common?) cases while keeping it relatively simple. Have you measured it before/after and against case-sensitive for large classes like \p{Lu}?

  4. BurntSushi commented on Apr 26, 2015

    @BurntSushi
    Member

    Not yet. Once I finish the rewrite, I'll add some benchmarks and maybe do some profiling to see if I can pick off low hanging fruit.

    But yeah, I feel like the entire way classes are constructed (particularly canoncalizing them) could be more clever. The code is pretty short/clear now though. :)

  5. BurntSushi commented on May 27, 2015

    @BurntSushi
    Member

    Weird that github didn't close this. Fixed by #87.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions