You benchmark only ever loads strict once making it marginally valid. If you start to factor in load times.....
use Benchmark 'cmpthese'; my %hash; cmpthese( 10000000, { with => sub {delete $INC{strict.pm}; use strict 'refs'; my $a = 1; +my $b = 2}, without => sub {delete $hash{key}; my $a = 1; my $b = 2}, } ); __DATA__ Benchmark: timing 10000000 iterations of with, without... with: 8 wallclock secs ( 9.10 usr + 0.00 sys = 9.10 CPU) @ 10 +98538.94/s (n=10000000) without: 3 wallclock secs ( 4.04 usr + 0.00 sys = 4.04 CPU) @ 24 +78314.75/s (n=10000000) Rate with without with 1098539/s -- -56% without 2478315/s 126% --
You need to delete an imaginary hash key in the without to be fair. This a more realistic benchmark outside of persistent processes. Nonetheless the contribution of strict to the total overheads is trivial and I always use it.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Re: Re: to strict or not to strict
by tachyon
in thread to strict or not to strict
by castaway
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |