-
Jean Boussier authored
`DEFAULT_EXP` is by far the most common regexp being anchored. By special casing it, we can re-use the existing `DEFAULT_EXP_ANCHORED` regexp, and avoid keeping lots of copies of it in memory. Every time we hit, we also avoid having to compile the regexp, so it's faster. We also replace the `Regexp.new(/\A#{sym}\Z/)` pattern by just `/\A#{sym}\Z/`, as it was compiling and instantiating an extra regexp for no good reason.
Jean Boussier authored`DEFAULT_EXP` is by far the most common regexp being anchored. By special casing it, we can re-use the existing `DEFAULT_EXP_ANCHORED` regexp, and avoid keeping lots of copies of it in memory. Every time we hit, we also avoid having to compile the regexp, so it's faster. We also replace the `Regexp.new(/\A#{sym}\Z/)` pattern by just `/\A#{sym}\Z/`, as it was compiling and instantiating an extra regexp for no good reason.
Loading