Polishing Python: Preventing Performance Corrosion with Rust
summary
Compares Python and Rust by porting a pure‑Python payment handler into PyO3 and packaging with Maturin and a Rust crate for parallelism (rayon). Benchmarks run 3,000 customers × 10,000 payments = 30 million transactions: baseline Python averages ~2.5 minutes, Rust single‑thread is ~30% faster, Rust + parallelism falls to ~1:06 (~55% speedup). Implements moving average, standard deviation and 95% VaR in Rust; it works but payoff appears only for large, CPU‑bound batches and adds build and maintenance complexity.
AI-written summary · about
chapters (12)
- 0:00Python and Rust performance
- 4:40Python simplicity costs
- 7:25Rust speed and safety
- 14:50Python-Rust integration
- 17:18Payment handler case study
- 22:16Python to Rust structs
- 25:31Python vs Rust benchmarks
- 27:58Rust challenges
- 29:02Rust integration worth it
- 30:07Q&A on abstractions
- 33:01Use cases and limits
- 34:06Migration approaches
related talks
44mDo Pythons Rust? How we used PyO3 to build a Python Stream Processor w/ a Rust Heart
46mPython + Rust = ?
34mRust for the Python dev
31mCan Rust make Python shine?
36mPumping up Python modules using Rust
31mPumping up Python modules using Rust
44mHow Python Harnesses Rust through PyO3
25mIntegrating Rust with Python...
