
8 Nov
2004
8 Nov
'04
5:05 p.m.
John Goerzen writes:
Yes it does. If you don't set block buffering, GHC will call read() separately for *every* single character. (I've straced stuff!) This is a huge performance penalty for large files. It's a lot more efficient if you set block buffering in your input, even if you are using interact and lines or words to process it.
That shouldn't be the case. GHC's IO library checks whether a Handle refers to a TTY, and enables line buffering if it does. Otherwise, block buffering is the default. Could you isolate the test case and submit a bug report? Cheers, Simon