Laziness (was: [Haskell-cafe] Performance problem with random numbers)

Brandon S. Allbery KF8NH allbery at
Sun Oct 14 18:14:40 EDT 2007

On Oct 14, 2007, at 17:54 , ntupel wrote:

> Now my problem still is, that I don't know how to speed things up. I
> tried putting seq and $! at various places with no apparent  
> improvement.
> Maybe I need to find a different data structure for my random  
> module and
> lazy lists are simply not working well enough here?

Unfortunately I'm not so good at that myself.  Even more  
unfortunately, my understanding is that randomly using seq and/or $!  
not only usually doesn't help, but can actually make things slower;  
and to do it right, you need to refer to the "simplified" Core  
Haskell code generated by GHC.  And understanding *that* requires  
rather more familiarity with Core than I have.  :/

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at
system administrator [openafs,heimdal,too many hats] allbery at
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list