~/talk

Making Python 100x faster with less than 100 lines of Rust

Talkat PyCon Israel 2024 · on Monday, 2024-09-16· [rust, python]
slides:none on file

Claims a ~100x speedup on a small numpy-based library by profiling with py-spy sampling profiler, porting the hottest Python function to Rust with pyo3 and maturin, then converting the Polygon class to a native Rust struct to avoid Python-level iteration and copies. Benchmarks drop from ~2880 ms per run to ~30 ms after two staged changes (first function replacement ~10x, then class-level rewrite ~10x), keeping the same API and under 100 lines of Rust.

AI-written summary · about

  1. 0:00Introduction and context
  2. 3:19Identifying performance bottlenecks
  3. 7:56Profiling with py-spy
  4. 10:03Rewriting Python to Rust
  5. 14:02Benchmarking improvements
  6. 17:37Summary and results
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.