Skip to content
  • Jean Boussier's avatar
    e2a83cd9
    Reduce allocations and retentions in Journey TransitionTable · e2a83cd9
    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.
    e2a83cd9
    Reduce allocations and retentions in Journey TransitionTable
    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