How to Optimize your Python Program for Slowness
summary
Short Python programs emulate Turing machines and also a stack of nested, dynamically bound loops to reach astronomic runtimes, including a Busy Beaver 5 (47,176,870 steps) emulator and constructions that produce 10 up-arrow up-arrow 15. Implementation details matter: gmpy2-style mutable big ints, a pure-Python emulator, a Rust extension that yields a Rust extension: 124× speedup and an assembly path with ~750× speedup, and a streaming visualizer that compresses rows so the whole pipeline actually runs and halts.
AI-written summary · about
chapters (7)
- 0:00Optimizing Python for slowness
- 1:25Impossibly long programs
- 5:24Turing machines in Python
- 13:16Dynamically bound loops
- 21:49Faster Python techniques
- 28:56Visualizing Turing runs
- 30:20Q&A
related talks
33mWhy is Python slow?
28mWhy Python Loops Are "Slow": A Gentle Introduction to Interpretation, Bytecode, and Fast Code
19mPython - best practices
30mWrite faster Python! Common performance anti patterns
48mPython Performance: Past, Present and Future
01h 12mFurious & Fast Python 7: Writing Fast Python Code
39mCPython, Grumpy, PyPy - When, How, Why
57mPython and PyPy performance (not) for dummies
