Jelle Feringa wrote: > Hi Dag Severre, > > Thanks, I will read through the "Comments on example code" thread, > sorry I missed out on that. > Thanks also for the example you gave. > > I did not understood why its necessary to wrap the do_curvature call > in Cython though: the call is close enough to C++ execution speed. > This is the point we disagree on :-) When wrapping the function using SWIG, it means that calling it has to happen by calling a Python function -- meaning amongst other things that the arguments and results are packed into Python objects and unpacked again etc.
Of course, the relative impact of this depends on how much time is spent in the C++ function. > Like Robert points out: I can measure a 500*500 loop in Python, it > would be hard to measure it in Cython. > That's the bit I'm interested in ;') > But it is certainly measurable if you put a SWIG function call within it! If the call overhead of calling the SWIG function times 500^2 is acceptable, then you are indeed right, the following can be implemented and will give the speed you are after: loop_fast2d( do_curvature, do_result, (1,500), (1,500) ) It is just that we don't consider it fast enough. This is likely to give a 2x speed increase at best, while the speed increases we seek using Cython are typically in the order of 100x. Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
