#4507: Data.List.sum and Data.List.product unnecessarily inefficient
---------------------------------+------------------------------------------
    Reporter:  pozorvlak         |       Owner:                                 
        Type:  bug               |      Status:  new                            
    Priority:  normal            |   Component:  libraries/base                 
     Version:  7.0.1             |    Keywords:  Data.List, sum, product, foldl'
    Testcase:                    |   Blockedby:                                 
          Os:  Unknown/Multiple  |    Blocking:                                 
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown                   
---------------------------------+------------------------------------------
 Despite the advice given in
 http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl%27, the versions of
 sum and product in Data.List don't use foldl'. This makes them much slower
 and more memory-hungry than they need to be: for instance, on my machine
 Data.List.sum [1..10000000] takes over 15 minutes and uses half my RAM,
 whereas foldl' (+) 0  [1..10000000] completes in only a few seconds and
 uses less than 10% of my RAM.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4507>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to