[issue34561] Replace list sorting merge_collapse()?

Tim Peters report at bugs.python.org
Sun Aug 29 19:42:55 EDT 2021


Tim Peters <tim at python.org> added the comment:

Added new runstack.py.

New `shivers2()` adds the implementation of adaptive ShiversSort from Vincent's later paper. While the code is simpler, it appears to behave identically.

New `shivers3()` adds, from the same paper, the new "length-adaptive ShiversSort". Wow! This is the only thing we've seen yet that's in the same universe as powersort. In fact, it usually does a tiny bit better (on the randomized cases). But it's not obvious how to rework its "if" test to be truly efficient (as-is, it needs two divisions, two calls to `log2()`, and two calls to `floor()`).

Worth some thought, though. From the results here, length-adaptive ShiversSort is a bigger improvement over (plain-old) adaptive ShiversSort than the latter is over timsort.

----------
Added file: https://bugs.python.org/file50241/runstack.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34561>
_______________________________________


More information about the Python-bugs-list mailing list