[Haskell-cafe] Is Haskell capable of matching C in string
tanielsen at gmail.com
Fri Jan 22 10:30:33 EST 2010
> It seems to me this indicates that the big expense here is the call into the I/O system.
So let's make fewer I/O calls:
import qualified Data.ByteString.Char8 as S
null_str1 = S.concat $ take 1000 $ repeat $ S.pack "null"
n1 = 5000000 `div` 1000
main = withBinaryFile "out3.json" WriteMode $ \h -> do
hPutStr h "["
replicateM_ n1 (S.hPutStr h null_str1)
hPutStr h "]"
this is 10x faster. Whether this is cheating or not depends on what
John actually wants to do.
More information about the Haskell-Cafe