[Numpy-discussion] Unnecessarily bad performance of elementwise operators with Fortran-arrays

David Cournapeau cournape@gmail....
Fri Nov 9 20:33:10 CST 2007

On Nov 10, 2007 4:39 AM, Hans Meine <meine@informatik.uni-hamburg.de> wrote:
> On Freitag 09 November 2007, Travis E. Oliphant wrote:
> > >  While this is
> > > a good idea (also probably quite some work), the real thing bugging me is
> > > that the above DOUBLE_add could (and should!) be called by the ufunc
> > > framework in such a way that it is equally efficient for C and Fortran
> > > arrays.
> >
> > Yes, that's what I was talking about.  There is actually a path through
> > the ufunc code where this loop is called only once.  The requirement
> > right now is that all the arrays are C-contiguous, but this should be
> > changed to all arrays have the same contiguousness (and the output-array
> > creation code changed to create Fortran-order arrays when the inputs are
> > all Fortran-order).
> After some measurements, I must say that even the slower Fortran variant is
> competitive (read: faster ;-) ), compared with our very flexible dynamic
> functors used in the current interactive VIGRA.  IOW: Good job. :-)

I am not suprised at all: although I've seen many times people saying
that C++ can provide good abstractions without cost, this is not my
experience, at least with g++. Whatever the method/library used
(blitz, the ones in boost, etc...). I am really convinced that C++
provides the bad abstraction for numerical works (and the fundamental
design decision of C++ to avoid extending the language to implement
things in libraries instead is flawed, at least for numerical works).



More information about the Numpy-discussion mailing list