$s='a'x1e6; cmpthese -1, { a => q[ $s =~ m[(.)(?{$c=pos();})]g; ], b => q[ $s =~ m[(.)]g; ], };; Rate a b a 3924/s -- -100% b 4206322/s 107088% --