Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    
    ...
      a => sub{my $total = 0; $total += $_ for(1..1e6);},
      b => sub{my $total = 0; for(1..1e6){$total += $_;}},
    } );
    
  2. or download this
    Benchmark: timing 30 iterations of a, b...
             a:  8 wallclock secs ( 8.30 usr +  0.00 sys =  8.30 CPU) @  3
    +.62/s (n=30)
             b:  9 wallclock secs ( 9.03 usr +  0.02 sys =  9.05 CPU) @  3
    +.32/s (n=30)