Intuition vs. Reality: Surprising Truths in Python Performance
summary
Benchmarks use py benchmark on GitHub runners and a released performance lab called cut speed and measure time and peak memory via trace maloc; concrete results: len(listcomp) is fastest for counting evens but it peaks around 4 MB vs a few hundred bytes for generator/sum, showing a speed–memory tradeoff. Rewriting in Rust via rest import sometimes slows tiny functions because Python→Rust conversion costs dominate, in one case Rust is ~10× faster for compute‑heavy work; using pyo3 types to avoid full copies makes native code win.
AI-written summary · about
chapters (9)
- 0:00Performance intuition vs reality
- 2:27Python performance matters
- 7:47Counting even numbers
- 14:00String concatenation
- 17:38List comp vs map
- 21:56Recursive vs stack factorial
- 25:12Python rewritten in Rust
- 35:48Leaderboard results
- 36:31Key takeaways
related talks
46mPython + Rust = ?
01h 12mFurious & Fast Python 7: Writing Fast Python Code
19mPython - best practices
36mPolishing Python: Preventing Performance Corrosion with Rust
31mPumping up Python modules using Rust
19mMaking Python 100x faster with less than 100 lines of Rust
31mCan Rust make Python shine?
33mWhy is Python slow?
