Hi! Recently I found it too expensive to invoke generic functions in every single frame via translate-from-foreign and translate-into-foreign-memory, especially on ECL, which spends much more time to call a generic function than the ordinary one.
CFFI provides a more efficient way to convert FFI type by optimizing out the function calls at compile-time so that the implementations could avoid generic method dispatching and some implementations like SBCL can also avoid SAP to pointer conversion to improve the performance of the game.
So I wrote 2 macros that generate both the translation and expansion function in substitution of defmethod translate-into-foreign-memory and defmethod translate-from-foreign, in hopes they can reduce the FFI overhead of cl-raylib.
Hi! Recently I found it too expensive to invoke generic functions in every single frame via
translate-from-foreign
andtranslate-into-foreign-memory
, especially on ECL, which spends much more time to call a generic function than the ordinary one.CFFI provides a more efficient way to convert FFI type by optimizing out the function calls at compile-time so that the implementations could avoid generic method dispatching and some implementations like SBCL can also avoid SAP to pointer conversion to improve the performance of the game.
So I wrote 2 macros that generate both the translation and expansion function in substitution of
defmethod translate-into-foreign-memory
anddefmethod translate-from-foreign
, in hopes they can reduce the FFI overhead ofcl-raylib
.