3 ms·
I have used CFFI in a few projects for writing a core computation in actual, pure C, and dynamically calling it from Python. Performance is really great, I vast
by Derbasti 12y ago
I have used CFFI in a few projects for writing a core computation in actual, pure C, and dynamically calling it from Python. Performance is really great, I vastly prefer it over Cython.
But, it doesn't solve the vectorization problem. Often times, you have to transform simple iterative algorithms to a convoluted vectorized mess if you want to have decent performance. Not every procedure is easily expressed as matrix multiplication.
This is a very real cognitive tax of the vectorized approach. Thank you for your writeup!
- andreasvc 12y agoBut why do you prefer it over Cython, since it can also wrap "actual, pure C, and dynamically [call] it from Python"? What is the vectorization problem? Both Cython and Julia allow you to write tight loops and have them perform well.
- Derbasti 12y agoIn CFFI, you write either Python, or C. In Cython, you additionally write a weird dialect that is neither C nor Python. I prefer straight C over Cython.