The performance implication depends on your implementation. If it's a critical application, particularly one that iterates significantly, the difference may be significant. Conversely, if the code isn't iterative, or only sees a few iterations, the difference is likely neglible. Given this understanding, you may want to benchmark the codes using the Benchmark module:
use Benchmark qw(cmpthese);
@data = (1,2,3,4); # the values that would have been in @_
my $minCPUsec = 15;
cmpthese(-$minCPUsec, {
with => \&sub_with_ifs,
without => \&sub_without_ifs
});
And change @_ in the referenced subs to @data.
Additionally, you may be interested in the Benchmarking Your Code tutorial, but I'd recommend using cmpthese instead of timethese. | [reply] [d/l] [select] |