
Hi, I just updated to GHC 6.12.1, and I noticed a significant drop in I/O performance that I can't explain. The following code is a simple re-implementation of cat(1), i.e. it just echos all data from standard input to standard output:
module Main ( main ) where
import System.IO import Foreign ( allocaBytes )
bufsize :: Int bufsize = 4 * 1024
catBuf :: Handle -> Handle -> IO () catBuf hIn hOut = allocaBytes bufsize input where input ptr = hGetBuf hIn ptr bufsize >>= output ptr output _ 0 = return () output ptr n = hPutBuf hOut ptr n >> input ptr
main :: IO () main = do mapM_ (\h -> hSetBuffering h NoBuffering) [ stdin, stdout ] catBuf stdin stdout
That program used to have exactly the same performance as /bin/cat, but
now it no longer does:
| $ dd if=/dev/urandom of=test.data bs=1M count=512
|
| $ time /bin/cat