Hacker News new | ask | show | jobs
by aidenn0 1718 days ago
Comparing python's C extensions to CFFI is non-trivial because they work very differently. With Python, you implement the Python API in C, but with CFFI you implement the C API in lisp.

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.