Here's how I would write this, in Cython using "pure C" arrays: https://gist.github.com/syllog1sm/3dd24cc8b0ad925325e1 It's getting 18,000 steps/second, in the same ballpark as your C code. I prefer to "write C in Cython", because I find it easier to read than the numpy code. This may be my bias, though --- I've been writing almost nothing but Cython for about two years now. Btw, if anyone's interested, "cymem" is a…
If I could have your permission, I'd like to incorporate this into a future post in the series. I can credit you in any way that you'd like.
Edit: Submitted here. https://news.ycombinator.com/item?id=8483872