Recently I read a wonderful series of posts about using Python C API to speedup python scripts. But I’m not a C fun and I used Cython to ease the work. So I wonder how much could I get using Cython instead of Python C API?
On the last post of the series, I found a Cython version implemented by Matthew Honnibal here. It is very fast but too C++. I hope I can write another but more python version.
At last, I got an cython implementation that operates on numpy ndarrays. The speed is comparable to Matthew’s work, but looks more streight forward. I put the result below with no explaintion, but Cython corresponds to Matthew’s implementation and Cython PR is my python-erimplementation.
Also I tried the sample problem in both Julia and D lang. These languages are expected to achieve similar performance compared to C, but the implementations are maybe too naive to accomplish their top efficiency. These languages looks quite attractive and I spent hands of hours to read them but obviously not enough.