in reply to Re: Rexgrep
in thread Rexgrep
Hmm, substr is the winner in a big big way. Makes sense. What if we anchor the regexp? 'regexp' => sub { my($file) = $img =~ m#.*/(.*)$# } gives usBenchmark: timing 1000000 iterations of regexp, split, substr... regexp: 16 wallclock secs (16.27 usr + 0.03 sys = 16.30 CPU) split: 17 wallclock secs (15.88 usr + 0.00 sys = 15.88 CPU) substr: 6 wallclock secs ( 5.32 usr + 0.00 sys = 5.32 CPU)
Nothing else I tried improved things.regexp: 17 wallclock secs (16.15 usr + 0.00 sys = 16.15 CPU) split: 15 wallclock secs (15.93 usr + 0.00 sys = 15.93 CPU) substr: 5 wallclock secs ( 5.37 usr + 0.00 sys = 5.37 CPU)
|
|---|