[Haskell-cafe] Re: I/O performance drop in ghc 6.12.1
Peter Simons
simons at cryp.to
Thu Jan 14 18:05:10 EST 2010
Hi Svein,
> Hold on, he's using hGetBuf/hPutBuf.
exactly, that's what I was thinking. When a program requests that 'n'
bytes ought to be read into memory at the location designated by the
given 'Ptr Word8', how could GHC possibly do any encoding or decoding?
That API doesn't allow for multi-byte characters. I would assume that
hGetBuf/hPutBuf are the equivalent to POSIX read() and write()?
> I wonder if the difference goes away if the handle is explicitly set
> to binary?
I added an
mapM_ (\h -> hSetBinaryMode h True) [ stdin, stdout ]
to 'main', and it does seem to improve performance a little, but it's
still quite a bit slower than /bin/cat:
| $ time /bin/cat <test.data >/dev/null
|
| real 0m2.119s
| user 0m0.003s
| sys 0m1.967s
|
| $ time ./cat-hgetbuf <test.data >/dev/null
|
| real 0m3.449s
| user 0m1.137s
| sys 0m2.240s
Take care,
Peter
More information about the Haskell-Cafe
mailing list