Robert Bradshaw wrote: > On Wed, Jul 14, 2010 at 7:47 PM, Carl Witty <[email protected]> wrote: > >> On Wed, Jul 14, 2010 at 6:59 PM, Robert Bradshaw >> <[email protected]> wrote: >> >>>> In my experience, I always have to resort to Fortran or C++. Cython cannot >>>> use NumPy arrays efficiently as function arguments. That is a big show >>>> stopper. >>>> >>> Could you clarify? I suppose for very small arrays, there's the extra >>> O(1) type-check/stride extraction overhead. Is there anything else? Of >>> course there's always more room for improvement for the array type. >>> >> Sometimes I write functions that don't iterate over every element of >> their argument arrays :) >> > > Good point. How does Fortran handle this better? Does it just know > that the strides are not aliased? (Or, does it know dimensions/other > data at compile time.) > The problem in Cython is that one must reacquire the buffer if it is passed as a Python object, which has some overhead. Fortran just passes a pointer and associated shape. > >> In particular, I remember that when I was writing >> sage/plot/plot3d/implicit_surface.pyx, I wanted to make several chunks >> of code into methods but decided not to for efficiency reasons. (I'm >> not sure if I actually measured, or if I was just worried.) >> > > For reference, > http://hg.sagemath.org/sage-main/file/8dec8b43ccca/sage/plot/plot3d/implicit_surface.pyx#l1 > > >> If I was doing it again, I think I'd give up on the Cython numpy >> support and just use C pointers in that code... >> > > Clearly we need to be doing thing better :). > Definitely, this is the biggest long-standing complaint. I find myself working around it many times. This is what the kurt-gsoc branch is about. I just need time for it that I don't have (and nobody else has stepped up).
Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
