[cffi-devel] Performance of CFFI:PARSE-TYPE

Hans Hübner hans at huebner.org
Fri May 30 21:13:06 UTC 2008


On Fri, May 30, 2008 at 10:55 PM, Luís Oliveira <luismbo at gmail.com> wrote:
> On Fri, May 30, 2008 at 8:08 PM, Hans Hübner <hans at huebner.org> wrote:
>> On Fri, May 30, 2008 at 7:27 PM, Luís Oliveira <luismbo at gmail.com> wrote:
>>> Thanks to the optimization mentioned above (a compiler macro for
>>> foreign-alloc), foreign-string-alloc calls PARSE-TYPE only at
>>> compile-time.
>
> Actually, PARSE-TYPE is only called when FOREIGN-STRING-ALLOC itself
> is compiled. No type parsing occurs when FOREIGN-STRING-ALLOC is
> called, either at compile-time or runtime. Assuming the FOREIGN-ALLOC
> compiler macro kicks in, of course.

It seemingly does not:

CFFI> (trace parse-type)
NIL
CFFI> (foreign-string-alloc "foo")
0> Calling (PARSE-TYPE :CHAR)
<0 PARSE-TYPE returned #<FOREIGN-BUILT-IN-TYPE :CHAR>
0> Calling (PARSE-TYPE :UINT8)
<0 PARSE-TYPE returned #<FOREIGN-TYPEDEF :UINT8>
0> Calling (PARSE-TYPE :UINT8)
<0 PARSE-TYPE returned #<FOREIGN-TYPEDEF :UINT8>
0> Calling (PARSE-TYPE :UINT8)
<0 PARSE-TYPE returned #<FOREIGN-TYPEDEF :UINT8>
0> Calling (PARSE-TYPE :CHAR)
<0 PARSE-TYPE returned #<FOREIGN-BUILT-IN-TYPE :CHAR>
#<A Foreign Pointer #x2AAAB963F6D0>
4
CFFI> (lisp-implementation-version)
"Version 1.2-r9471M  (LinuxX8664)"

So, if I understand what you write, this basically means that the
FOREIGN-ALLOC compiler macro does not work.  I will try to isolate
this and ask the Clozure folks for help.

Thanks!
Hans



More information about the cffi-devel mailing list