[Haskell-cafe] How can I improve the pipes's performance with a huge file?

zhangjun.julian zhangjun.julian at gmail.com
Sun Nov 16 09:55:42 UTC 2014


Dear Tom and others

I had fix the problem, with change code by 

1, Change List to Sequence
2, Change mapM_ to Data.Traversable.sequence $ Sequence.map   

Thanks for you help


> 在 2014年11月16日,下午5:47,Tom Ellis <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> 写道:
> 
> On Sat, Nov 15, 2014 at 06:50:26AM +0800, zhangjun.julian wrote:
>> In the master branch  I had a list file to read, so I use mapM_ to call rCount as blow
>> 
>> mapM_ (\(x,y) -> rCount num readhandle1 x y) handlePairList
>> 
>> If I change my Map to Strict and  call rCount directly( don’t use mapM_ ) the memory will not swell.
>> 
>> I can understand why lazy Map will cause swell, but I don’t know why mapM_ will cause swell?
>> Does the mapM_ is lazy too? 
>> Any strict alternative I can use?
> 
> I think you need to provide us with more details about exactly what this
> mapM_ is doing.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list