[Haskell-cafe] Why doesn't GHC use the Hugs definition of splitAt to avoid traversing the first part of the list twice?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Apr 26 09:19:10 EDT 2008

On Apr 26, 2008, at 9:02 , Richard Kelsall wrote:

> I'm now wondering why my splitAtRK function in the following code
> makes it run in 11 seconds given a parameter of 2500000 but it takes
> 14 seconds when I change it to splitAt. Am I accidentally invoking

It's somewhat unusual to build the standard libraries with -O2, I  
think.  (It can be done but the build takes a very long time.)

Also, 11 vs. 14 seconds seems not that much of a difference when  
you're talking 2500000 items, especially given how inefficient  
Haskell lists (Strings are lists) are.

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

More information about the Haskell-Cafe mailing list