in reply to Re: Re: Re: Re: Circular buffer instead of shift/push
in thread Circular buffer instead of shift/push

Ok, revision thanks to chipmunk's online proofing in cb:
"petral: in your new benchmark, mod2andix is missing the assignment to the array element"

Back to my original point, only including equalandix:
'Yet ...'
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
... reverses the order(!?!).
...and my observations above -- that fundflow is probably right -- apply even more,


p