| Next | Making Programs Faster | 164 |
Here's some advice that is more Perl-specific
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?
It's important to keep these things in perspective
If you're really worried about the cost of a single rename, you are using the wrong language
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
The C version was 35 times faster
| Next | ![]() |
Copyright © 2003 M. J. Dominus |