in reply to Re: Re: Re: Re: Circular buffer instead of shift/push
in thread Circular buffer instead of shift/push
So I didn't have your wheel on top of my list, unless I'm doing my benchmarking wrong again.use Benchmark; my $m=4; my @a=(1,2,3,0); my $x=0; timethese(-10, { wheel => sub {$x = $a[$x]}, equaland => sub {++$x==$m and $x=0}, mod => sub {$x = ($x+1) % $m;}, trinary => sub {$x = ++$x==$m ? 0 : $x } } ); __END__ equaland: 23033.30/s trinary: 15301.14/s wheel: 12993.17/s mod: 12857.56/s
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Re: Circular buffer instead of shift/push
by petral (Curate) on Jan 16, 2001 at 08:24 UTC |