I guess this happens because duff's code have properly ordered array of probabilities, but origCode does not.
UPDATE: yes I am right
my @array = () x 100; cmpthese( 10000000, {head => sub{$array[0]}, tail => sub{$array[99]}} ); Rate tail head tail 4992511/s -- -3% head 5149331/s 3% --
UPDATE: no, I am wrong. In both the cases the order doesn't matter, sorry
In reply to Re^7: $str to %hash to @ary
by ccn
in thread $str to %hash to @ary
by abaxaba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |