I did also benchmark against the XS module, and my module is quite slow in comparison (duh) unless the strings are equal, where my short circuit (return 0 if $word1 eq $word2) lays the smack down, in the parlance of our times.

for your information, here are my benchmark results:
joshs-Computer:~/leven josh$ perl levenshtein.pl foo fee The distance between foo and fee is 2 Rate cpan mine cpanxs cpan 80.6/s -- -16% -97% mine 95.5/s 18% -- -97% cpanxs 2844/s 3430% 2879% -- joshs-Computer:~/leven josh$ perl levenshtein.pl foo foo The distance between foo and foo is 0 Rate cpan cpanxs mine cpan 83.2/s -- -97% -98% cpanxs 2849/s 3325% -- -31% mine 4109/s 4840% 44% -- joshs-Computer:~/leven josh$ perl levenshtein.pl foo bar The distance between foo and bar is 3 Rate cpan mine cpanxs cpan 81.2/s -- -15% -97% mine 95.4/s 18% -- -97% cpanxs 2829/s 3385% 2865% -- oshs-Computer:~/leven josh$ perl levenshtein.pl 1234567890 0987654321 The distance between 1234567890 and 0987654321 is 10 Rate cpan mine cpanxs cpan 9.35/s -- -24% -99% mine 12.3/s 31% -- -99% cpanxs 1782/s 18966% 14410% --

In reply to Re: Re: improved levenshtein by bageler
in thread improved levenshtein by bageler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.