in reply to perl compiler optimizer curiosity
I agree with the notion that calling a logging function which immediately returns shouldn't generate a much overhead. In a tight loop with lots of iterations (something that could make the overhead significant), i usually don't log on every iteration, only every 1000 or so:
for(my $i = 0; $i < 1_000_000; $i++) { if($i % 1000 == 0) { debug("Foo $i"); } # do some stuff }
|
---|