[issue9915] speeding up sorting with a key

Raymond Hettinger report at bugs.python.org
Tue Nov 30 23:22:08 CET 2010


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

+1 on the basic idea of moving elements in the keys and values arrays at the same time thereby eliminating the fragmented memory overhead of the sortwrapper indirection.

I would like the patch to be restricted to just that change.  The other tweaks are not convincing (relying on compiler and processor specific optimizations that vary across platforms).  Instead, try to minimize the patch, making as few changes as possible to manipulation both arrays.  Also, try to follow the C style of the other code in the standard library -- the current patch has a different flavor to say the least ;-)

Ideally, the code will have the same look and feel as it does now (so that the Timsort remains recognizable to Tim ;-).  This code doesn't just need to run fast, it needs to serve as a readable model for anyone else trying to implement the algorithm.

If you still want the other tweaks, I recommend putting them in a separate patch afterwards and consider deferring them to 3.3.  It's a little late in the dev cycle to make lots of microscopic changes that may introduce a bug or unexpected behavior or perform weirdly on one of the less used platforms.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9915>
_______________________________________


More information about the Python-bugs-list mailing list