|
|
|
|
|
by cnbland
1718 days ago
|
|
I feel inspired to start with Lisp after being disappointed with the "open" source scene of 2021. I'd rather pay LispWorks a yearly fee and be left alone than dealing with unbalanced people in the Python space. The free Lisp implementations also look somewhat isolated from the ideological wars. However, a C interface is required. Is this one the recommended solution? Is it really portable? https://common-lisp.net/project/cffi/ What is the speed compared to a Python C extension? Are implementation-specific C interfaces faster (I guess they are)? Sorry for so many questions, but these can usually only be answered by people who have actually used the interface. |
|
Re: CFFI vs. built-in API
The main difference is what features you have. For example, if you need errno, you will need to do something implementation specific (I'm currently working on a wrapper for that functionality though).
Another example: ECL let's you inline C code in the middle of a lisp program. Most other implementations don't.
As far as performance goes, the actual overhead of calling C is minimal, but if you need to copy large amounts of data, that can kill performance.
There is another library called static-vectors that let's you allocate buffers that can be used natively in both lisp and C, on the implementations that allow doing so.