Главная
Study mode:
on
1
Intro
2
Outline
3
Stable Sorting
4
CPython Sorting History
5
Timsort merge policy (original)
6
Invariant trouble
7
Timsort merge policy (patched)
8
Timsort bad case
9
Merge policies from first principles
10
Mergesort meets Binary Search Trees
11
Run-Boundary Powers are Local
12
Some performance data
13
Bonus: Multiway powersort
14
Conclusion
Description:
Explore the fascinating journey of CPython's list sorting function in this 30-minute PyCon US talk. Delve into the algorithmic ideas, engineering tricks, and trivia behind the latest updates. Discover how Tim Peters' Timsort, a clever Mergesort variant, replaced Quicksort and became widely adopted in various languages and frameworks. Learn about the two flaws discovered in Timsort's algorithm, including a potential stack overflow issue and suboptimal merge order performance. Understand how the Powersort merge policy, based on optimal alphabetic trees, addresses these challenges and improves efficiency. Follow the evolution from Quicksort to Timsort and finally to the new implementation in Python 3.11.0. Gain insights into stable sorting, CPython sorting history, merge policies, and the connection between Mergesort and Binary Search Trees. Suitable for algorithm enthusiasts, performance-oriented programmers, and Python users curious about the inner workings of list sorting.

Algorithmic Ideas, Engineering Tricks, and Trivia Behind CPython's New Sorting Algorithm

PyCon US
Add to list
0:00 / 0:00