[Numpy-discussion] Speeding up Numeric

Travis Oliphant oliphant at ee.byu.edu
Fri Jan 21 17:32:59 CST 2005

David M. Cooke wrote:

>$ opstack -t 1 /usr/bin/python
>  self     %        child    %        image name               symbol name
>132281   10.5031  0              0  python                   (no symbols)
>704810   55.9618  0              0  _numpy.so                check_array
>309384   24.5650  0              0  umath.so                 DOUBLE_add
>112974    8.9701  0              0  libc-2.3.2.so            (no symbols)
>The -t 1 limits the display to those routines taking more than 1% of
>the runtime. 10% for python, and 10% for the C-library probably aren't
>so bad (I'm thinking that's calls to malloc() and friends). However,
>the big problem is that only 25% of the time is actually doing useful
>work. What's check_array doing? We can delve deeper:
Thanks for this *excellent* tutorial and analysis.  I would love to see 
more of this. 

I've never liked the check_array concept.   In fact, if you use SciPy 
which makes several changes to things that Numeric does, check_array 
never runs, because self->check_return is 0 for all SciPy Ufuncs (e.g. 
those in fastumath). So, perhaps some of these basic benchmarks should 
be run by SciPy users.

I forgot about this little speed-up that SciPy users enjoy all the 
time.  SciPy has also added inf and Nan.

I would be very willing to remove check_array from all Numeric ufuncs 
and create a separate interface for checking results, after the fact.  
What is the attitude of the community.



More information about the Numpy-discussion mailing list