On Mon, Feb 9, 2009 at 12:49 PM, Ketil Malde <ke...@malde.org> wrote: > Reading the binary file is very efficient thanks to Data.Binary. > However, output is a different matter. Currently, my code looks > something like: > > summarize :: Foo -> ByteString > summarize f = let f1 = accessor f > f2 = expression f > : > in B.concat [f1,pack "\t",pack (show f2),...] > > which isn't particularly elegant, and builds a temporary ByteString > that usually only get passed to B.putStrLn. I can suffer the > inelegance were it only fast - but this ends up taking the better part > of the execution time.
Is building the strict ByteString what takes the most time? If so, you might want to use `writev` to avoid extra copying. Does your data support incremental processing so that you could produce output before all input has been parsed? Cheers, Johan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe