Bellow is my code
someFunc :: IO ()
someFunc = --print $ resultPar
print$ runEval $ (do
fib44<- rpar (force $fib 44)
fib45<- rpar (force $fib 45)
fib46<- rpar (force $fib 46)
fib47<- rpar (force$ fib 47)
-- rseq fib44
-- rseq fib45
-- rseq fib46
rseq fib47
return [fib44,fib45,fib46,fib47]
)
where
resultPlain=[fib 44,fib 45,fib 46 ,fib 47]
resultPar= parMap rpar (force.fib) [ 44, 45, 46 , 47]
resultSeq= parMap rseq (force.fib) [ 44, 45, 46 , 47]
I have add -O2 -threaded
to the cabal file, and I run this program with command cabal v2-run +RTS -N4
.
No matter how I modify the code, it is always as slow as running line by line.
Because I have run these code line by line.