Switch to new-style callbacks
See original GitHub issueSee: https://cffi.readthedocs.io/en/latest/using.html#extern-python-new-style-callbacks
The original callbacks are slower to invoke and have the same issue as libffi’s callbacks; notably, see the warning. The new style described in the present section does not use libffi’s callbacks at all.
Occurrences of ffi.callback
:
https://github.com/libvips/pyvips/blob/1dc365a3beb6484d609d3aa725cd871c68af2ef0/pyvips/gvalue.py#L23 (Seems no longer used ?)
https://github.com/libvips/pyvips/blob/52e218462af9261766f5aebf60b8a39ef0c3e2c2/pyvips/__init__.py#L134 (Used by the log handler)
https://github.com/libvips/pyvips/blob/52e218462af9261766f5aebf60b8a39ef0c3e2c2/pyvips/base.py#L87 (Used by the documentation generator)
https://github.com/libvips/pyvips/blob/1dc365a3beb6484d609d3aa725cd871c68af2ef0/pyvips/voperation.py#L106 (Hot path code, used by almost all pyvips operations. Perhaps we should use vips_object_get_args
for libvips 8.7+. See the lua-vips implementation)
This comment can also be solved using the new style callbacks.
After this has been resolved, we should look at https://github.com/libvips/pyvips/issues/21 again and benchmark it under cffi’s API mode (the Pillow performance test suite still depends on an older version of pyvips which doesn’t support the API mode).
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (17 by maintainers)
Top GitHub Comments
If I do a
conda install libvips cffi pkgconfig
followed bypip install pyvips
then it does correctly build pyvips in API mode, and is using the conda libvips binaries. Just for whatever reason, aconda install pyvips
will build in ABI mode. I’ll open an issue on the conda-forge pyvips feedstock page for that.I think mixing conda and homebrew binaries in one process is not really supported and it likely to bite you at some point. My understanding (maybe wrong) is that you are supposed to use the conda libvips binaries with conda python.
(I use homebrew for everything on macos, fwiw)