[Numpy-discussion] Half baked C API?
perry at stsci.edu
Tue Mar 15 11:03:57 CST 2005
On Mar 15, 2005, at 1:18 PM, Ralf Juengling wrote:
> konrad.hinsen at laposte.net wrote:
> > How much do you expect to gain compared to a Python loop in such
> > a case?
> I'd expect a factor 5 to 10.
How did you come to that conclusion? It's not at all clear to me that
the overhead of the Python operation (i.e., calling the appropriate
Python method or function from C) will add appreciably to the time it
takes to call it from C. Remember, the speed of the C version of the
Python function may have much more overhead than what you envision for
an equivalent C function that you would write. So it isn't good enough
to compare the speed of a python loop to the C code to do sum and dot
that you would write. Adding these to the API is extra work, and worse,
it perhaps risks making it harder to change the internals since so much
more of what is in C is exposed. The current API is essentially
centered around exposing the data and means of converting and copying
the data, and to a lesser extent, building new UFuncs (for use at the
More information about the Numpy-discussion