[Haskell-cafe] best strategy for comparing comparisons

Jason Dusek jason.dusek at gmail.com
Mon Aug 11 04:04:10 EDT 2008

  I'd like to perform a micro-benchmark, pitting ByteString
  comparision against Word comparison. What I'd like to do is:

 .  Generate a bunch of random Word32s.
 .  Generate strict ByteStrings containing those Word32s.
 .  Compare every Word32 with every other Word32 for equality,
    and see how long it takes.
 .  Ditto with ByteStrings.

  The first two are easy and I'm done with them already. The
  latter two seem like they'll run afoul of laziness. I have two
  ideas about how to do them:

 .  Do every comparison with a list comprehension, compressing
    the result as I go using `all`.

 .  Do every comparison in a recursive IO procedure.

  Are there other ways? Will strictness annotations, for
  example, allow me to run comparisons on larger lists?


More information about the Haskell-Cafe mailing list