Re: [Setup-tool-hackers] copy, move and delete



On Wed, 2001-09-05 at 17:44, Tambet Ingo wrote:
> I just discovered that we are not using perl functions for file
> operations. Why not? Using perl's own functions we win in execution time
> (yeah, 1 usec or so :) but more importantly in portatibility.

I tried to time it, just for fun, here are the (surprising?) results:

use Benchmark;
my $t0 = new Benchmark;
for (0 .. 1000) { &xst_file_run ("rm -rf /tmp/something"); }
my $t1 = new Benchmark;
my $td = timediff ($t1, $t0);
print timestr ($td), "\n";

Printed out:
10 wallclock secs ( 0.22 usr  0.38 sys +  3.29 cusr  5.87 csys =  9.76
CPU)

while

use Benchmark;
my $t0 = new Benchmark;
for (0 .. 1000) { unlink ('/tmp/something'); }
my $t1 = new Benchmark;
my $td = timediff ($t1, $t0);
print timestr ($td), "\n";

resulted:
0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)


I'd call it amazing! :)

Tambet


_______________________________________________
setup-tool-hackers maillist  -  setup-tool-hackers@ximian.com
http://lists.ximian.com/mailman/listinfo/setup-tool-hackers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]