Rakudo Perl 6 A Rakudo Performance #31

Using native int support

  my $N = 100000;                  my $N = 100000;
  my int $i = 0;                   my int $i = 0;
  my int $j = 0;                                   
  
  # start timer                    # start timer
  while $j < $N {                  for 0..^$N  -> int $j {
      $i = $i + $j;                    $i = $i + $j;
      $j = $j + 1;                 }
  }
  # stop timer                     # stop timer

Results (seconds):

              2011.01  2011.07  2012.01  2012.06   

while 0..^N    23.04    14.43     2.24     1.63   
for 0..^N      34.93    26.90     1.43     1.09   
startup         0.62     0.59     0.12     0.09   
while + int                       1.44     1.00     
for + int                         0.97     0.74     
Copyright © 2012
http://www.pmichaud.com/2012/pres/