in reply to Re: Re: Re: Re: Circular buffer instead of shift/push
in thread Circular buffer instead of shift/push
... reverses the order(!?!).my $m=4; my $x=$m; $m--; my @n=(1..$m,0); my @a=(); timethese(-10, { wheelix => sub {$a[ $x = $n[$x] ] = $x }, equalandix => sub {$a[ ++$x==$m and $x=0 ] = $x }, mod2andix => sub {$a[ ++$x, $x &= $m ] = $x;} } ); equalandix: 113742.08/s mod2andix: 116579.70/s wheelix: 126698.60/s
|
|---|