[Numpy-discussion] Recarray sort() slowness
Sun Mar 4 07:18:22 CST 2007
I've finally implemented Chuck's suggestion of sorting of a recarray of
two fields (the first being the actual array to be sorted and the other
being the array to be reordered following the resulting order for the
first one). Indeed, this approach saves me an amount of memory
equivalent to the size of the second column, which is really nice.
However, I'm afraid that I wouldn't be able to use this approach as it
is 25x slower (see the attached benchmark; beware! only runs on a Linux
kernel 2.6!) than regular argsorting of the first field and then doing a
fancy indexing over the second. If the slowdown would be 2x I still can
have a chance to use it, but 25x is a no go.
I'm curious why the recarray.sort(order='fieldN') is so slow, and I'm
wondering if this can be speed-up in some way or another.
Francesc Altet | Be careful about using the following code --
Carabos Coop. V. | I've only proven that it works,
www.carabos.com | I haven't tested it. -- Donald Knuth
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2030 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070304/74d2a2eb/attachment.py
More information about the Numpy-discussion