efficiency

Manuel M. T. Chakravarty chak at cse.unsw.edu.au
Mon Dec 4 20:36:04 EST 2000


qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) wrote,

> Mon, 4 Dec 2000 04:15:28 -0800, Simon Marlow <simonmar at microsoft.com> pisze:
> 
> > Ok, so the malloc/free is the most expensive part.  I'm moderately
> > surprised:)  Perhaps we could do a better job, but we'll never do
> > better than ByteArrays as long as the bracket is required.
> 
> BTW, withCString in my implementation which handles charsets does not
> use alloca but malloc. It's because we don't know the length of the
> resulting char[] until we convert it, so we cannot preallocate it.
> We must guess an initial size and realloc the array as needed.
> 
> Hence unfortunately speeding up alloca won't speed my implementation
> of the common need of allocating C objects.

Hmm, Unicode support seems to interact quite badly with the
FFI...

Manuel




More information about the FFI mailing list