ParList vs parTraversable

I found the "weird" behavior here. I got it:

{-# LANGUAGE BangPatterns #-} import Data.List import Control.Parallel import Control.Parallel.Strategies fib 0 = 1 fib 1 = 1 fib n = fib (n-1) + fib (n-2) main = let xs = [ fib (20 + n `mod` 2) | n <- [0..1000] ] `using` test rseq in print (sum xs) test :: Strategy a -> Strategy [a] test strat xs = do parTraversable strat xs -- case #1 -- parList strat xs -- case #2 return xs 

case #1 means using parTraversable , case #2 means using parList . The results are different:

 case #1: SPARKS: 1001 (1 converted, 0 overflowed, 0 dud, 1000 GC'd, 0 fizzled) case #2: SPARKS: 1001 (1000 converted, 0 overflowed, 0 dud, 0 GC'd, 1 fizzled) 

As far as I know, parList same as parTraversable . In Control/Parallel/Strategies.hs :

 parTraversable :: Traversable t => Strategy a -> Strategy (ta) parTraversable strat = evalTraversable (rparWith strat) parList :: Strategy a -> Strategy [a] parList = parTraversable 

Therefore, I believed that they should act in the same way. Anything to reveal here?

Update # 1 :

Commands to compile and run:

 stack ghc -- -O2 -threaded -rtsopts -eventlog parlist2.hs ./parList2 +RTS -N2 -s 
+7
parallel-processing haskell
source share

No one has answered this question yet.

See related questions:

114
Haskell thread heap overflow even though total memory is only 22 MB?
4
How can I track / reduce GC time in GHC?
4
parTraversable without creating sparks
3
Efficient parallel scheduling algorithm for calculating the average value of an array
3
Haskell: why sequential start sequentially?
2
Understanding the result of a parBuffer-based strategy

All Articles