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

Hans Hübner hans at huebner.org
Mon Jun 2 19:33:22 UTC 2008


On Fri, May 30, 2008 at 5:13 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.

> 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.

The reason for this was the very high debug and safety optimization
settings (safety 3 debug 3) that have been in use when compiling the
application.  When compiling with (debug 1 safety 2), the compiler
macro is used as expected.

Thanks!
Hans



More information about the cffi-devel mailing list