Hello,

In Control.Parallel.Strategies, parList is defined as

    parList strat []     = ()
    parList strat (x:xs) = strat x `par` (parList strat xs)

with

    parMap strat f xs = map f xs `using` parList strat.

I have recently found that if I define

    forceParMap strat f xs = map f xs `using` forceParList strat

where

    forceParList strat = foldl (\done -> (done>||) . strat) ()

then to date, forceParList via forceParMap gives faster results
than parList via parMap.  For example, in one experiment, parMap
with parList run at 0.81 the time of the serial solution whereas
forceParMap with forceParList run at 0.58 the time of the serial
solution.  This is to say, forceParList completed in 0.72 the
time of parList.  So,

1. Why is forceParList faster than parList?
2. Is this generic to the ghc runtime model or a particularity
   of the ghc implementation?

Thanks in advance for the clarification,
- Marcus



_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to