[cffi-devel] WITH-POINTER-TO-VECTOR-DATA ?

Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle at t-systems.com
Tue Dec 19 09:44:32 UTC 2006


Luke Crook wrote:
>An SDL_Surface is basically a foreign array. Reading 
>and writing individual pixels involves calling MEM-AREF
>to access an integer value ...
>Can I use WITH-POINTER-TO-VECTOR-DATA to somehow speed this up? 

Nope, WITH-POINTER-TO-VECTOR-DATA is not the right abstraction for this.
As you said, you have a foreign array. Alas, CL does not allow to
portably extend the built-in ARRAY type.  Your best bet is to look at
CFFI's proposed block transfer operations, which ought to be optimised
for speed.
http://cffi.common-lisp.net/project/cffi/darcs/cffi/doc/mem-vector.txt

Outside of CFFI's scope, you may find that some implementations provide
for means to have specialised Lisp arrays mapped at known (malloc'ed)
locations.  I believe Allegro features this.  Then you can use all of
CL's array and sequence functions on the foreign memory area.

Regards,
	Jorg Hohle.



More information about the cffi-devel mailing list