[commit: parallel] master: cope with chunk sizes smaller than 2 (#5100) (f82611f)
Simon Marlow
marlowsd at gmail.com
Thu May 19 10:20:47 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/parallel
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/f82611fac439236e22a057cd555bb9fe393597b0
>---------------------------------------------------------------
commit f82611fac439236e22a057cd555bb9fe393597b0
Author: Simon Marlow <marlowsd at gmail.com>
Date: Wed May 18 16:45:37 2011 +0100
cope with chunk sizes smaller than 2 (#5100)
>---------------------------------------------------------------
Control/Parallel/Strategies.hs | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Control/Parallel/Strategies.hs b/Control/Parallel/Strategies.hs
index 7b0cd6f..b37a3f1 100644
--- a/Control/Parallel/Strategies.hs
+++ b/Control/Parallel/Strategies.hs
@@ -428,9 +428,13 @@ parListNth n strat = evalListNth n (rpar `dot` strat)
-- It is expected that this function will be replaced by a more
-- generic clustering infrastructure in the future.
--
+-- If the chunk size is 1 or less, 'parListChunk' is equivalent to
+-- 'parList'
+--
parListChunk :: Int -> Strategy a -> Strategy [a]
-parListChunk n strat xs =
- concat `fmap` parList (evalList strat) (chunk n xs)
+parListChunk n strat xs
+ | n <= 1 = parList strat xs
+ | otherwise = concat `fmap` parList (evalList strat) (chunk n xs)
chunk :: Int -> [a] -> [[a]]
chunk _ [] = []
More information about the Cvs-libraries
mailing list