FPS, ForeignPtr and GHC 6.6

Simon Marlow simonmarhaskell at gmail.com
Fri Apr 21 09:57:47 EDT 2006


Bulat Ziganshin wrote:
> Hello Simon,
> 
> Friday, April 21, 2006, 3:44:17 PM, you wrote:
> 
> 
>>The point is that you can't implement all the operations in FPS using a
>>ByteArray# representation, so that's a bogus comparison.
> 
> that operations can't be implemented with pinned byte arrays? i think
> only mmap support?

Many of the operations in "Low-level constructors"

   http://www.cse.unsw.edu.au/~dons/fps/Data.FastPackedString.html#21

plus mmapFile.

>>ForeignPtr is the right thing!
> 
> they are slower in 6.4

Performance with 6.4 isn't a priority, since the library is going into 
6.6.  By all means write a version that works better with 6.4 in the 
meantime.

> data ForeignPtrContents
>   = PlainForeignPtr !(IORef [IO ()])
>   | MallocPtr (MutableByteArray# RealWorld) !(IORef [IO ()])
> 
> you mean adding 3rd variant here:
> 
>   | PlainMallocPtr (MutableByteArray# RealWorld)
> 
> ?

Yes

> btw, i still wondering - that is the difference between
> MutableByteArray# and ByteArray# ? :)

ByteArray# doesn't have the state parameter, it can be read outside of 
the IO/ST monads.  The point is to add a little type safety, it doesn't 
have any impact on the implementation.

Cheers,
	Simon


More information about the Libraries mailing list