I/O overhead in opening and writing files

Donn Cave donn at avvanta.com
Mon Aug 27 23:33:43 CEST 2012

Quoth Johan Tibell <johan.tibell at gmail.com>,
> Could you try using the Data.ByteString API. I don't have the code in
> front of me so I don't know if the System.Posix API uses Strings. If
> it does, that's most likely the issue.

It does, but it can also read directly to Ptr Word8 (fdReadBuf), which
you'd think would be closer to hardware speed - but then you might lose
the advantage trying to peek the data out of the buffer.  In principle
you ought to be able to stuff that pointer right into a ByteString,
but don't know for sure that there's any public API for such.  I guess
you may be proposing to use Data.ByteString.hGet?

Look out for character set conversions!  Even if String were affordable
in terms of resources, I'm not sure there's any way to avoid this


More information about the Glasgow-haskell-users mailing list