in reply to Re^2: Why does global match run faster than none global?
in thread Why does global match run faster than none global?
Even more intriguing. The slowest has hardly changed, but the previously faster ones have slowed markedly.
C:\test\perl-5.14.0-RC1>perl use Benchmark qw[ cmpthese ];; print $];; $str = '123456789'; cmpthese -1, { a=>q[ my ($a,$b) = $str =~ m/(23)[^8]+(8)/g; ], b=>q[ my ($a,$b) = $str =~ m/(23)[^8]+(8)/; ], c=>q[ my ($a) = $str =~ m/(23)/g ], d=>q[ my ($a) = $str =~ m/(23)/; ], };; ^Z 5.014000 Rate b a d c b 363518/s -- -17% -35% -46% a 435446/s 20% -- -22% -35% d 555991/s 53% 28% -- -17% c 668598/s 84% 54% 20% --
But still, 20% is not to be sneezed at.
|
|---|