Because capturing is the most expensive thing that happens there. On a ten minute program I shaved a minute off by avoiding capturing groups (you mistook (?>...) for a capture block) and using substr instead. A minute is pretty small for the thirty megabyte data set I was working with, I just expected most data sets to be half a gig or more. I picked a simpler example for this code sample - it still illustrates the point (and verified through dprof).
unless ($$buffer =~ m/^H=(?>\d+);/) { confess "$rec_num was missing the header prefix m/^H=\\d+;/: $$buf +fer"; } my $header_length = substr $$buffer, 2, $+[0]-3; # vs unless ($$buffer =~ m/^H=((?>\d+));/) { confess "$rec_num was missing the header prefix m/^H=(\\d+);/: $$b +uffer"; } my $header_length = $1;
In reply to Re: Re: Inlining method/function calls?
by diotalevi
in thread Inlining method/function calls?
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |