[NumPy-Tickets] [NumPy] #450: Make a.min() not copy data

NumPy Trac numpy-tickets@scipy....
Fri Aug 19 17:44:16 CDT 2011


#450: Make a.min() not copy data
------------------------------------------+---------------------------------
 Reporter:  goddard                       |       Owner:  somebody    
     Type:  defect                        |      Status:  needs_review
 Priority:  normal                        |   Milestone:  Unscheduled 
Component:  Other                         |     Version:  devel       
 Keywords:  reduce, memory, optimization  |  
------------------------------------------+---------------------------------
Changes (by mwiebe):

  * status:  new => needs_review


Comment:

 In my missingdata branch, I've implemented the tuple of axes idea. I've
 changed numpy.min to use this, whereas ndarray.min is still using the old
 way. You can see the difference this makes:

 {{{
 In [2]: a = np.random.rand(1000,1000,10)

 In [3]: timeit a.min()
 1 loops, best of 3: 78.4 ms per loop

 In [4]: timeit np.min(a)
 10 loops, best of 3: 77.8 ms per loop

 In [5]: timeit a[1:,1:,1:].min()
 1 loops, best of 3: 6.39 s per loop

 In [6]: timeit np.min(a[1:,1:,1:])
 1 loops, best of 3: 119 ms per loop
 }}}

 Line [5] hit swap space on this machine due to the copy, which is why it
 took a lot longer

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/450#comment:11>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list