[vector] #92: foldl' within Foldable instance seems broken

vector vector at projects.haskell.org
Sat Feb 23 17:35:28 GMT 2013


#92: foldl' within Foldable instance seems broken
------------------------+---------------------------------------------------
Reporter:  MikeIzbicki  |       Owner:             
    Type:  defect       |      Status:  new        
Priority:  major        |   Milestone:             
 Version:               |    Keywords:  performance
------------------------+---------------------------------------------------
 When I run this piece of code:

 {{{
 import qualified Data.Vector as V
 import qualified Data.Foldable as F
 size=10^8
 main = do
     print $ (V.foldl (+) 0 $ (V.enumFromN (0::Double) size) :: Double)
     print $ (V.foldl' (+) 0 $ (V.enumFromN (0::Double) size) :: Double)
     print $ (F.foldl (+) 0 $ (V.enumFromN (0::Double) size) :: Double)
     print $ (F.foldl' (+) 0 $ (V.enumFromN (0::Double) size) :: Double)
     putStrLn "done."

 }}}

 The first three numbers print almost instantly, but the last number takes
 forever to print.  The profiler is telling me that the garbage collector
 is going off like mad.  Shouldn't F.foldl' be the exact same thing as
 V.foldl'?

-- 
Ticket URL: <http://trac.haskell.org/vector/ticket/92>
vector <http://trac.haskell.org/vector>
Package vector


More information about the vector mailing list