[NumPy-Tickets] [NumPy] #1779: array.tolist() speed enhancement

NumPy Trac numpy-tickets@scipy....
Wed Mar 23 13:07:32 CDT 2011


#1779: array.tolist() speed enhancement
-------------------------+--------------------------------------------------
 Reporter:  Han          |       Owner:  somebody    
     Type:  enhancement  |      Status:  needs_review
 Priority:  normal       |   Milestone:  1.6.0       
Component:  Other        |     Version:  devel       
 Keywords:  tolist       |  
-------------------------+--------------------------------------------------

Comment(by mwiebe):

 I made a pull request which gives some speedup.

 https://github.com/numpy/numpy/pull/59


 {{{
 # BASELINE:
 In [16]: timeit a = np.arange(100000)
 1000 loops, best of 3: 241 us per loop

 In [17]: timeit range(100000)
 100 loops, best of 3: 2.29 ms per loop

 In [18]: timeit a.tolist()
 100 loops, best of 3: 14.9 ms per loop

 # WITH PATCH
 In [3]: timeit a = np.arange(100000)
 1000 loops, best of 3: 245 us per loop

 In [4]: timeit range(100000)
 100 loops, best of 3: 2.4 ms per loop

 In [5]: timeit a.tolist()
 100 loops, best of 3: 3.57 ms per loop
 }}}

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


More information about the NumPy-Tickets mailing list