Hi > > (Some list operations are too expensive with ByteString but for most > > string processing it's perfectly fine and much faster than String). > > I'm sure it's true, but it's quite irrelevant to my question, which is > "why is using getChar so much slower than using getContents"?
Buffering, blocks and locks. Buffering: getChar demands to get a character now, which pretty much means you can't buffer. Blocks: getContents reads blocks at a time from the underlying library, whereas getChar has to do one character at a time. Locks: getChar has to acquire locks, as does getContents. However, because getContents can operate on blocks, this requires many fewer locks. Thanks Neil _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe