ByteString I/O Performance

Bryan O'Sullivan bos at serpentine.com
Sun Sep 2 23:23:25 EDT 2007


Peter Simons wrote:

> One way to get malloc() out of the picture would be to provide a
> variant of hGet that takes an existing, pre-allocated buffer as an
> argument, so that the user can allocate a ByteString once and re-use
> it for every single hGet and hPut.

This is already quite easy to do.  See unsafeUseAsCStringLen in 
Data.ByteString.Base, and hGetBuf in System.IO.

	<b


More information about the Libraries mailing list