[SciPy-User] Cython vs Vectorized Numpy vs MATLAB

Sturla Molden sturla@molden...
Fri Nov 18 11:33:27 CST 2011


NumPy will still be NumPy. It does not care if you call it from Python 
or Cython.

In some circumstances, using loops in Cython instead of NumPy will help. 
That is, when the NumPy expression is memory-bound and the Cython loop 
is compute-bound. In all other circumstances, you should expect no 
significant difference.

Sturla

Den 18.11.2011 17:39, skrev Jaidev Deshpande:
> Haha, thanks :)
>
> Yeah, I guess that's not how Cython works. I think I'll go and read a
> little bit more about NumPy and Cython.
>
> Thanks again!
>
> On Fri, Nov 18, 2011 at 3:45 PM, Yury V. Zaytsev<yury@shurup.com>  wrote:
>
>> On Wed, 2011-11-16 at 05:45 +0530, Jaidev Deshpande wrote:
>>> 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?
>>> Vectorized NumPy
>>> takes.................................................
>>>   1.0342 second
>>> The above,
>>> Cythonized ...................................................
>>> 0.997 seconds
>> It did give you *some* speed-up, didn't it?
>>
>> Why would you expect more, if all you are doing is calling Python
>> primitives directly via Cython-compiled code instead of parsing the
>> Python file and byte-compiling it first?
>>
>> --
>> Sincerely yours,
>> Yury V. Zaytsev
>>
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20111118/8b6205fa/attachment.html 


More information about the SciPy-User mailing list