my @s = '0001' .. '1000'; cmpthese -1,{ d => q[ my @d = @s; ], c => q[ my @c = @s; $c[ $_ ] += 0 for 0 .. $#c; ], a => q[ my @a = @s; $_ += 0 for @a; ], b => q[ my @b = @s; my @new; push @new, $_ + 0 while defined( $_ = shift @b ) ], }; #### Rate c a b d c 793688/s -- -59% -59% -84% a 1941807/s 145% -- -0% -60% b 1942492/s 145% 0% -- -60% d 4812084/s 506% 148% 148% -- #### my @s = '0000001' .. '1000000'; cmpthese -1,{ d => q[ my @d = @s; ], c => q[ my @c = @s; $c[ $_ ] += 0 for 0 .. $#c; ], a => q[ my @a = @s; $_ += 0 for @a; ], b => q[ my @b = @s; my @new; push @new, $_ + 0 while defined( $_ = shift @b ) ], }; #### Rate c b a d c 764586/s -- -58% -62% -85% b 1803742/s 136% -- -10% -65% a 2007409/s 163% 11% -- -61% d 5119310/s 570% 184% 155% --