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 where 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. Cheers, -- Felipe. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe