http://www.perlmonks.org?node_id=664686


in reply to Re: Performance of possessive quantifiers
in thread Performance of possessive quantifiers

try

m/(?>$re)+(*SKIP)\d/

on 5.11

And it looks like something broke the superlinear cache. Even with atomic matching this pattern/string combination goes quadratic, as nothing anchors the start of the pattern. Without the atomic matching its worse. Im not sure what the deal is with $re++ either. I would have expected that to have similar performance to (?>$re)+, its possible thats actually a bug. Ill have to think about it.

Oh, and dont use benchmarks from a debugging perl. Depending on the code path you go through variable amounts of debugging goo, so using a debugging perl, especially a 5.9.x or later version will not give useful results even comparing features.

---
$world=~s/war/peace/g