Python constant-factor engineering at scale
- Stage
- 7
- Module
- M7.12
- Lessons
- 1
In this module
- Identify performance bottlenecks in Python programs that run on PyPy.
- Use flat 1D lists and parallel lists instead of tuples and dictionaries.
- Encode integers into single values to reduce memory and cache misses.
- Read input in one call, join output, and measure on maximum-size test cases.
- Know when further optimisation returns diminishing marks and when to stop.
Before this module
Lessons
Practice
Try these on the judge. Each link opens the problem on DMOJ.
- 2019 S4Tourism (opens on DMOJ in a new tab) DMOJ
Find the minimum cost to process a stream of updates to a flat array.
Why DMOJ: An older large-input problem, good for practicing fast I/O and tight loops.
- 2015 S5Greedy For Pies (opens on DMOJ in a new tab) DMOJ
Compute the shortest meeting time for scheduled intervals.
Why DMOJ: An older problem that builds timing-critical fast-I/O and loop skills.