[cffi-devel] defcfun optimization idea
hi! when i was optimizing time functions in osicat i was pondering that cffi:defcfun could add an ftype declaim to the emitted defun based on the ffi types. it may be only a heuristic, but most of the time the return value could be annotated which would help the compiler. it would also be useful if there was a way to tell defcfun to declare the emitted defun to be inline. </random ideas> -- attila
On Tue, May 13, 2008 at 4:51 PM, Attila Lendvai <attila.lendvai@gmail.com> wrote:
it may be only a heuristic, but most of the time the return value could be annotated which would help the compiler.
Sounds straightforward for integer types, and there's a pointer type somewhere as well. What about floats? From the manual: "On most but not all systems, :float and :double represent a Lisp single-float and double-float, respectively. It is not so useful to consider the relationship between Lisp types and C types as isomorphic, as simply to recognize the relationship, and relative precision, among each respective category." I don't remember what the implications are.
it would also be useful if there was a way to tell defcfun to declare the emitted defun to be inline.
Why not let the user decide that? -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/
"Luís Oliveira" <luismbo@gmail.com> writes:
What about floats? From the manual:
"On most but not all systems, :float and :double represent a Lisp single-float and double-float, respectively. It is not so useful to consider the relationship between Lisp types and C types as isomorphic, as simply to recognize the relationship, and relative precision, among each respective category."
I don't remember what the implications are.
If I recall correctly, it means that because Lisp's float types are not specified in terms of C's, thinking of C:floats and C:doubles as L:single-floats and L:double-floats is bound to lead to confusion. I suppose the information about float types, and perhaps all types, could come from CFFI-SYS. -- But you know how reluctant paranormal phenomena are to reveal themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003
participants (3)
-
Attila Lendvai
-
Luís Oliveira
-
Stephen Compall