in reply to Re: Re: Slow file creator
in thread Slow file creator
This clearly shows the loop decreases performance.use Benchmark::Timer; my $t = Benchmark::Timer->new(); my $size = 1000000; $t->start( 'string' ); open FW, "> temp.out"; print FW " " x $size; close FW; $t->stop( 'string' ); $t->start( 'loop' ); open FW, "> temp.out"; for ( 0..$size ) { print FW " " } close FW; $t->stop( 'loop' ); $t->report; __END__ Reports: 1 trial of string (17.594ms total) 1 trial of loop (733.321ms total)
|
|---|