gh-135551: Change how sorting picks minimum run length (#135553)

New scheme from Stefan Pochmann for picking minimum run lengths.

By allowing them to change a little from one run to the next, it's possible to
arrange for that all merges, at all levels, strongly tend to be as evenly balanced
as possible, for randomly ordered data. Meaning the number of initial runs is a
power of 2, and all merges involve runs whose lengths differ by no more than 1.
This commit is contained in:
Tim Peters 2025-06-26 23:48:05 -05:00 committed by GitHub
parent b38810bab7
commit 2fc68e180f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 184 additions and 41 deletions

View file

@ -1481,6 +1481,7 @@ Jean-François Piéronne
Oleg Plakhotnyuk
Anatoliy Platonov
Marcel Plch
Stefan Pochmann
Kirill Podoprigora
Remi Pointel
Jon Poler

View file

@ -0,0 +1 @@
Sorting randomly ordered lists will often run a bit faster, thanks to a new scheme for picking minimum run lengths from Stefan Pochmann, which arranges for the merge tree to be as evenly balanced as is possible.