in reply to Re^3: Why does global match run faster than none global?
in thread Why does global match run faster than none global?

Why would it take longer? All the /g version does in addition to the non-/g version is check if "9" is "23". Actually, it doesn't even get that far. It knows a minimum of 4 chars is needed for another match, yet there's only one char left.
  • Comment on Re^4: Why does global match run faster than none global?

Replies are listed 'Best First'.
Re^5: Why does global match run faster than none global?
by Kc12349 (Monk) on Aug 23, 2011 at 21:08 UTC
    Fair enough, but in the case of searching for m/(23)/, /g will continue to the end of the string, while none /g should stop after its match. In this case it still seems like /g should be slower, though surely I could confused or missing something.
      Finding that "456789" doesn't contain "23" can be done in nanoseconds.