On Sep 13, 2010, at 4:05 AM, Gustavo wrote:
Em 13 de setembro de 2010 02:05, JTK
<jetmonk@gmail.com> escreveu:
It looks like some implementations need you to say that the array should be created in static memory so it doesn't get relocated. In your library, SBCL is somehow privileged, which is not bad but neither ideal. CFFI seems to have code for using pointers to native Lisp arrays in various implementations. I think the right answer would be to extend the specification of the proposal. CFFI should detect the cases where the implementation can't provide a pointer to the array so it copies the array instead.
Just a though.
Perhaps my explanation is confusing. Each Lisp is treated exactly the same, because WAAF uses only
the public CFFI interface. My code knows nothing about different Lisp implementations.
SBCL is just an example case that runs very fast, without consing. CCL is
slower and conses, but it is not at optimized as SBCL in general.
I agree that the best of all possible worlds would be code that exploits each Lisp to the fullest of its abilities,
passing Lisp arrays when it can, and copying when necessary. But even a copying-only implementation
is nice to have, because people keep inventing and reinventing it, and doing it well is a fair bit of work. And it
can always be improved case by case. And even copy-only has good performance.
At any rate, I've simply put WAAF on
cliki.net. As long as CFFI doesn't have this capability, people
can use it if they like or pick another one of the several array interfaces available (though I wish
their authors would publicize them on
cliki.net).
John