4
當我與-s
運行此程序:parTraversable不產生任何火花
module Main where
import Control.Parallel.Strategies
main :: IO()
main = do let xs = take 1000 $ product . take 1000 . repeat <$> [1..]
x = product (xs `using` parList rseq)
putStrLn (show x)
火花被創建:
SPARKS:1000(993轉換,0溢出,0啞彈,6 GC'd ,1失敗了)
如果更改parList
parTraversable
到
x = product (xs `using` parTraversable rseq)
無火花被創建:
SPARKS:0(0轉換,0溢出,0啞彈,0 GC'd,0失敗了)
如果更改rseq
到rdeepseq
:
main = do let xs = (take 1000 $ product . take 1000 . repeat <$> [1..]) :: [Integer]
x = product (xs `using` parList rdeepseq)
putStrLn (show x)
無火花產生
個SPARKS:0(0轉換,0溢出,0啞彈,0 GC'd,0失敗了)
我使用平行3.2.1.1和在源代碼,parList
使用parTraversable
定義!
parList :: Strategy a -> Strategy [a]
parList = parTraversable
我在想什麼?