Help for this page

Select Code to Download


  1. or download this
    q(
    Benchmark: timing 100000 iterations of C-style, push...
       C-style:  2 wallclock secs ( 3.20 usr +  0.00 sys =  3.20 CPU) @ 31
    +279.32/s (n=100000)
          push:  3 wallclock secs ( 2.63 usr +  0.09 sys =  2.72 CPU) @ 36
    +724.20/s (n=100000)
    
  2. or download this
    #These "cripple" C-style and push to make it a fair fight, by reinitia
    +lizing the array each time
    Benchmark: timing 100000 iterations of C-style, destroy, push...
    ...
          push:  2 wallclock secs ( 2.38 usr +  0.00 sys =  2.38 CPU) @ 41
    +9463.09/s(n=1000000)
    
    );
    
  3. or download this
    @in = (1,2,3,4,5,6,7,8,9,0);
    use Benchmark;
    ...
                 push @out1, shift(@in);
                 push @out2, shift(@in); }'
              });
    
  4. or download this
    q(
    #These "cripple" C-style and push to make it a fair fight, by reinitia
    +lizing the array each time
    ...
                 print OUT @out1,"\n";
                 print OUT @out2,"\n";'
              });