in reply to Re: Re: Re: Circular buffer instead of shift/push
in thread Circular buffer instead of shift/push
Well, ok. For some reason the 2 statement version is much faster@a=(1,2,3,0); $x=0; $m=4; timethese(-10,{ ixwheel=> q{ $x = $a[$x] } modby2x1=> q{ $x = (++$x) & $m} }); ixwheel: 434505.60/s modby2x1: 391856.16/s timethese(-10,{ ixwheel=> q{ $x=$a[$x] } modby2x2=> q{ $x++; $x &= $m }}); ixwheel: 433011.28/s modby2x2: 539474.07/s
Again, this seemed to be the fastest of the variations.timethese(-10,{ ixwheelix=> q{ $b[ $x=$a[$x] ] = $x } modby2x2ix=> q{ $b[$x++] = $x; $x &= $m }}); ixwheelix: 262030.67/s modby2x2ix: 220259.36/s
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Circular buffer instead of shift/push
by repson (Chaplain) on Jan 13, 2001 at 13:14 UTC | |
by petral (Curate) on Jan 16, 2001 at 08:24 UTC | |
|
Re: Re: Re: Re: Re: Circular buffer instead of shift/push
by fundflow (Chaplain) on Jan 14, 2001 at 04:57 UTC |