in reply to Re^3: Producing a list of offsets efficiently
in thread Producing a list of offsets efficiently
Thoughts?
#! perl -slw use strict; use Benchmark::Timer; my $T= new Benchmark::Timer; for( 1 .. 1000 ) { my @small = (1) x 100; my @large = (1 ) x 130900; $T->start( "small: add 100 by 1" ); push @small, 1 for 1 .. 100; $T->stop( "small: add 100 by 1" ); $T->start( "large: add 100 by 1" ); push @large, 1 for 1 .. 100; $T->stop( "large: add 100 by 1" ); $T->start( "small: add 100 by 100" ); push @small, 1 .. 100; $T->stop( "small: add 100 by 100" ); $T->start( "large: add 100 by 100" ); push @large, 1 .. 100; $T->stop( "large: add 100 by 100" ); } $T->report; __END__ P:\test>461552,pl 1000 trials of small: add 100 by 1 ( 94.947ms total), 94us/trial 1000 trials of large: add 100 by 1 (112.226ms total), 112us/trial 1000 trials of small: add 100 by 100 ( 16.009ms total), 16us/trial 1000 trials of large: add 100 by 100 ( 15.977ms total), 15us/trial
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Producing a list of offsets efficiently
by tilly (Archbishop) on May 30, 2005 at 05:20 UTC | |
by BrowserUk (Patriarch) on May 30, 2005 at 06:45 UTC | |
by tilly (Archbishop) on May 30, 2005 at 07:16 UTC | |
by BrowserUk (Patriarch) on May 30, 2005 at 07:37 UTC | |
by tilly (Archbishop) on May 30, 2005 at 07:53 UTC | |
|