|Just another Perl shrine|
Optimizing a string processing subby spurperl (Priest)
|on Jan 08, 2003 at 19:23 UTC||Need Help??|
spurperl has asked for the
wisdom of the Perl Monks concerning the following question:
I'm looking for suggestions to optimize the following task:
Given two words, find how many characters they share. For instance, "help" and "temp" share 2 characters, "monk" and "perl" share 0, etc...
First, I implemented the following simple version:
Then, I tried optimizing it. The following is a regexp version:
Benchmarking proved that the second version is about 50% slower than the first & simple one.
Any ideas on how this can be made faster ?