in reply to To warn or not to warn, that is the question
Actually it does look like the extra test for $_ affects execution speed.
Do_not_test: 11 wallclock secs (10.01 usr + 0.00 sys = 10.01 CPU) @ 365830.27/s (n=3661961) Test_defined: 8 wallclock secs (10.02 usr + 0.00 sys = 10.02 CPU) @ 363485.63/s (n=3642126)
Ignoring the wallclock seconds, Do_not_test ran about 2,000 more times per second than did Test_defined (or about 0.5%). Okay, so it's not going to bring the CPU to a grinding halt, but every cycle counts (especially if, like me, you're still working on an old, old computer :)
Oh, and I think my $x = sub() || 0; is a good idea.
|
|---|