in reply to Re: Re: Re: Optimizing existing Perl code (in practise) in thread Optimizing existing Perl code (in practise)
No the do not perform the same function. Your re method
functions as a gaurd clause allowing for a) early failure and b)
avoiding assignment on failure. The split version performs the
assignment even if the strings do not match the pattern. If your data
is always going to pass the re, then the split version would be the
faster version (and even better than your split version would be
split " ", $foo). Care to show your benchmark where the
re version was 90% faster?
|