On 12 Dec 2008, at 1:33 , Joris De Ridder wrote:

> I implemented the same function using C++ & ctypes, and the latter  
> function turns out to be about 100 times faster than the cython one,  
> for a 500x500 image, and dx,dy = 5,5. This surprises me, because of  
> the simplicity of the function. I checked the C file, and also the  
> translation of the maxfilter() function in C is quite simple. The  
> bulk of the time is of course spent in the loops, and the only  
> bottleneck that I can see is accessing the numpy arrays. Is there  
> anything I can do in Cython to speed that up?

My statement turned out to be wrong: I misread the unit of the  
timing. :-/  Cython took 168 ms, ctypes+Cpp took 1.41 s. Prejudiced  
about the speed of C++, I misread the latter as 1.41 ms. So, it turns  
out that Cython was actually 10 times faster!  I'm still a bit puzzled  
about this difference, but it's on the ctypes side I have to look, not  
on the cython side.

Thanks for the responses, and sorry for the noise.

Joris



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to