Writing performant code for modern Python interpreters
summary
Modern interpreters like piston reduce interpretation overhead and apply JITs, and experiments show global lookups become much faster when globals aren’t reassigned (about 6× faster in one piston benchmark), but some old tricks backfire: caching methods used to cut ~66% on CPython yet method-cache can slow code on optimizers, math.sqrt and os.path.join show only tiny gains now, C extensions still win for numeric work, and attaching profilers often disables optimizations.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:35Why Python is slow
- 3:54New projects
- 4:32Controversial slide
- 8:38What makes Python slow
- 11:01Global Variables
- 13:49Attributes
- 16:42Happy case
- 17:38Avoid this
- 18:33Attribute lookup
- 19:24Benchmarks
- 22:16Dynamic features
- 23:17C extensions vs Python
- 26:08Conclusion
related talks
24mHow two undergrads from the other side of the planet are speeding up...
59mMyths and fairy tales around Python performance
48mPython Performance: Past, Present and Future
01h 03mA tour of CPython's runtime
42mOptimizing Code Performance for Python Internals
01h 12mFurious & Fast Python 7: Writing Fast Python Code
26mPython Performance at Scale - Making Python Faster at Instagram
29mWhat they don't tell you about building a JIT compiler for CPython
