Data.List.sum and Data.List.product unnecessarily inefficient
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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |