in reply to Re^4: Hamming Distance Between 2 Strings - Fast(est) Way?
in thread Hamming Distance Between 2 Strings - Fast(est) Way?
Of course you are right, nothing is deleted without /d.
However, the "count the stars" mode does seem to be consistantly around 10% quicker?
$s = "\0\1" x 10000;; cmpthese -1, { A=> q[ $n1 = $s =~ tr[\0][\0] ], B=> q[ $n2 = $s =~ tr[\0][]c ] }; Rate B A B 23522/s -- -9% A 25935/s 10% -- print "$n1 : $n2";; 10000 : 10000
|
|---|