[NumPy-Tickets] [NumPy] #1386: 100 times poorer performance indexing scalar record array
NumPy Trac
numpy-tickets@scipy....
Sun Jan 31 15:08:00 CST 2010
#1386: 100 times poorer performance indexing scalar record array
---------------------------+------------------------------------------------
Reporter: oscar.bristol | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: numpy.core | Version:
Keywords: |
---------------------------+------------------------------------------------
Assigning to a field in a scalar record array like this
B['a'] = A['a']
takes around 50 times as long as assigning like this:
B['a'][:] = A['a']
and 100 times as long as assigning to a size 1 record array.
I've attached a script (test.py) that compares scalars and size 1 arrays
and the two different methods of indexing above. On my machine, the
results are:
$ python test.py 100000
array, B['a'][:] = A['a'] 0.25 seconds
array, B['a'] = A['a'] 0.213 seconds
scalar, B['a'][:] = A['a'] 0.395 seconds
scalar, B['a'] = A['a'] 22.0 seconds
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1386>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list