[Haskell-cafe] hamming distance allocation

John Lato jwlato at gmail.com
Mon Apr 19 11:12:26 EDT 2010

> From: Daniel Fischer <daniel.is.fischer at web.de>
> Am Montag 19 April 2010 14:37:33 schrieb John Lato:
>> Is it really necessary to use Strings?  I think a packed type, e.g.
>> Vector or ByteString, would be much more efficient here.
> Not very much if the strings are fairly short (and the list isn't too long,
> so there's not a big difference in cache-friendliness).
> If eight-bit characters aren't enough, packing the strings into
> UArray Int Char gives performance quite close to ByteStrings.

I agree, provided that the Strings are used only once.  I missed the
first part of this thread, so there may be context I don't have, but
if Strings are retained and the Hamming distance calculated for
multiple pairings, I think it would be a noticeable difference.
Although probably not as much as reducing the number of calls to
Hamming as you and H. Apfelmus suggest.


More information about the Haskell-Cafe mailing list