2011/5/20 Bas van Dijk <[email protected]>: > On 19 May 2011 10:53, Johan Tibell <[email protected]> wrote: >> Long term we'd like to switch bytestring over >> from ForeignPtr to ByteArray#, if possible. There are currently some >> technical obstacles to such a switch > > BTW I'm working with Roman Leshchinskiy to create the > vector-bytestring package which provides: > type ByteString = Data.Vector.Storable.Vector Word8 > and exports the same API as the bytestring package (no support for > lazy bytestrings yet) > > A storable vector still uses a ForeignPtr but maybe this will make the > switch to unboxed Vectors (which use ByteArray#) easier. > > Expect some code to be up somewhere next week. > > Bas >
OK, that sounds interesting. I'm looking forward to your code. One trick, I'm using in the blaze-builder implementation is that the current buffer is denoted by a region (pf :: Ptr Word8, pe :: Ptr Word8) of the next free byte `pf` and the first byte after the buffer `pe`. This only works for pinned ByteArrays/ForeignPtrs. Do you know what the cost of such an array/foreignptr is? Moreover, after creation I could "unpin" the array. Do you perhaps know if thats possible in principle? best regards, Simon _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
