efficiency
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Mon Dec 4 13:15:45 EST 2000
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.
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTÊPCZA
QRCZAK
More information about the FFI
mailing list