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

Travis E. Oliphant oliphant@enthought....
Thu Nov 8 23:38:39 CST 2007

David Cournapeau wrote:
> Travis E. Oliphant wrote:
>> I wasn't talking about the min, mean, and max methods specifically.  
>> These are all implemented with the reduce method of a ufunc. 
> Ah, my mistake, I wrongly understood only some of them were implemented 
> through ufunc. But the ufunc machinery has nothing to do with output 
> array output, right ? So is the 5 time speed increase mainly happening 
> inside ufunc ?

I'm not sure.   Ufuncs don't do everything in NumPy as you have noted.  
There are less well publicized (and less structured) array functions for 
each data-type that also implement things.   Not all of these places 
have "optimized" paths, but there was some thought given to it in 
several places of the code.

One area that could be improved that may be exposed in some of the 
timing tests, is that iterator-based algorithms  always use a 
"C-contiguous" iterator.  There is no "Fortran-contiguous" iterator 
(although there could be).

-Travis O.

More information about the Numpy-discussion mailing list