[SciPy-User] Cython vs Vectorized Numpy vs MATLAB

Dag Sverre Seljebotn d.s.seljebotn@astro.uio...
Wed Nov 16 03:49:08 CST 2011

On 11/16/2011 01:15 AM, Jaidev Deshpande wrote:
> Hi,
> I have two questions.
> 1. Why does the 'spline.m' function in MATLAB perform much faster than
> the same interpolation in NumPy?
> (In MATLAB the first function call takes time but the subsequent calls
> are much faster.)
> 2. I wrote a cubic spline interpolation algorithm with NumPy and I
> vectorized it. Is it surprising that the Cython compiled version of the
> same function is no faster? I guess that shouldn't happen, as parts of
> the code would be compiled into C. Although, please note that I used
> Cython on the vectorized code *as it is*, without adding static types. I
> know, stupid thing to do, but shouldn't it have given me *some *speed-up?

Why do you think that it should?

Dag Sverre

More information about the SciPy-User mailing list