[Haskell-cafe] Benchmarks game updated to ghc 6.12.2

Felipe Lessa felipe.lessa at gmail.com
Thu Apr 29 06:53:42 EDT 2010

On Thu, Apr 29, 2010 at 10:54:09AM +0200, Ketil Malde wrote:
> Anyway - it occurs to me that this can fairly simply be sped up by
> parallelizing: chunk the input, complement chunks in parallel, and
> reverse.  Any takers?

Do you mean, something like this?

  import Data.ByteString.Char8 as S
  import Data.ByteString.Lazy.Char8 as L
  import Data.ByteString.Lazy.Internal as LI

  map' :: (Char -> Char) -> L.ByteString -> L.ByteString
  map' f = go
      go LI.Empty        = LI.Empty
      go (LI.Chunk x xs) = let fx  = S.map f x
      	                       fxs = go xs
			   in fxs `par` LI.Chunk fx fxs
                           -- Chunk is strict in fx.



More information about the Haskell-Cafe mailing list