Proposal: Make intersperse lazier

Christian Maeder Christian.Maeder at
Tue Sep 21 05:28:46 EDT 2010

Am 21.09.2010 11:08, schrieb John Lato:
> Which compiler/version are you using for your tests?  Is the behavior
> the same for other compilers/versions?  In particular, is it similar for
> ghc-6.10, ghc-6.12, and ghc-HEAD?

I've used ghc-6.12.3. My top-level file is Bench.hs:

import Criterion.Main
import Interspersing

testCase f = print . length . f ','

main = do
  let s = replicate  10000000 'A'
  print $ length s
  defaultMain [ bench "isgo" $ testCase isgo s
              , bench "isrec" $ testCase isrec s ]

(using Daniel's Interspersing module)

I compiled by:
  ghc -O2 -fforce-recomp -fext-core --make Bench.hs

and ran:
  ./Bench -s 10

> When benchmarking variants like this, I'm always suspicious that my
> optimizations may be ghc-version-specific, since I've had occasional
> experience to the contrary.

Yes, and after years, you'll sometimes find out that your pragmas, bangs
and other quirks actually made things worse.

Cheers Christian

More information about the Libraries mailing list