Next Making Programs Faster 164

Good Advice

If you're worried about the slowness of two opens and a rename, why aren't you worried about the much greater slowness of perl?

     int main(void) {                   my $total;               
       int i, j;                        for (0 .. 999) {         
       long total;                        $total = 0;            
       for (i=0; i<1000; i++) {           for my $j (0 .. 999) { 
         total = 0;                         $total += $j;        
         for (j=0; j<1000; j++) {         }                      
           total += j;                  }                        
         }                              print $total, "\n";
       }
       printf("%ld\n", total);
     }
     real    0m0.071s                   real    0m2.493s
     user    0m0.060s                   user    0m2.340s
     sys     0m0.000s                   sys     0m0.020s

Next Copyright © 2003 M. J. Dominus