Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Some of the above suggestions, benchmarked (Re: Similarity of strings)by jmcnamara (Monsignor) |
on May 15, 2002 at 23:38 UTC ( [id://166876]=note: print w/replies, xml ) | Need Help?? |
I'm glad that someone benchmarked this. However, you were a little bit unfair to the chop method. :-) The scalar reverse and array assignments aren't necessary. The following is 5 times faster (although still 5 times slower than the xor method):
Update: Albannach points out that because the strings in this test are not of equal length, the reverse is required. My code was based on the original sample data. Also, it is worth adding that the speed of the xor method is less dependent on the string length than the other methods.
--
In Section
Seekers of Perl Wisdom
|
|