ByteString I/O Performance
simons at cryp.to
Tue Sep 4 14:07:05 EDT 2007
Donald Bruce Stewart writes:
>> hGet :: Handle -> ByteString -> IO ByteString
>> hGet h buf = do i <- Str.unsafeUseAsCStringLen buf (\(p,n) -> hGetBuf h p n)
>> return (Str.unsafeTake i buf)
> That's a useful benchmark. Thanks for looking into this.
It was a pleasure. How do you feel about providing this kind of
input API to the user as part of the module?
Note that the current hGet can be implemented on top of the
combinator above, but the reverse is not true. So I guess that
this API is strictly more powerful than the one we currently
have. And for some use cases, it's significantly faster too.
By the way, did you receive my e-mail about the race condition in
More information about the Libraries