I have a program in python using numpy and scipy.
adding cython in it will be a time taking process as there are many changes in data types
The cprofile of it looks like this:
https://i.stack.imgur.com/O2J9O.jpg
Most of the time (73% ) is used up by <scipy.integrate_odepack.odeint>
My question basically is, does using cython speed up this function(maybe by faster calling) and the rest.
This function is called ~10^6 times in this example.
And if so, How much speed up can I expect?
I consider pursuing this if speed up is atleast 4x to 5x
note:
If the information provided is insufficient, please comment below and I’d be glad to provide
Thank you
Well half of the time of
<scipy.integrate_odepack.odeint>is being spent insidedx_dvanddx_duthese look like they’re python functions. These are functions you could target especially if they are complex.One thing to bear in mind is that if the slow down is just because of the
calling overhead * number of callsthen I wouldn’t expect things to improve much. That overhead won’t disappear, in fact it might be made more complex. Instead of SciPy C -> Python, you’ll be doing SciPy C -> Python -> your C.