Hi,
On Sun, Apr 14, 2013 at 10:35 AM, <_
k...@yahoo.com> wrote:
> my taste. In return I'd try and present the world with a cffi wrapper for
> libeinspline, which isn't what you'd call popular, but some may think it a
> gem :)
Cool ! Thanks for mentioning it here.
> I've wrapped a large library using cffi, and I've added a fair amount of C
> declarations via cdef() and C code via verify(). The declarations and
> definitions weigh in at about 3000 lines of C. Everything is running nicely
> so far, but the load times are quite long. On my T2...@1.6GHz loading the
> module takes some 1.9 seconds (compared to ca. 75 miliseconds to load
> numpypy).
We need to fully parse the C code every time in order to build the
"ctype" objects --- including the ctype of all functions. It's a
known issue. One way to speed it up would be to include in the .so
some fast pickle-like data dump out of which we can reload the ctypes.
I think that at least for large projects the approach should be: write
the cdef and verify in its separate Python module, which is not
imported at all in normal runs of the program; the program would only
say: ffi = FFI("my_cffi_lib.so"). This would be a clean split of the
"compile-time" and the "run-time".
A bientôt,
Armin.