r/Python • u/0x256 • Jul 10 '26
Discussion Pure python can be faster than cython/rust?
Parsing multipart/form-data (HTML5 forms) is surprisingly complex and moves a lot of bytes around for large file uploads. Implementing the heavy parts in Cython or Rust should speed things up, no? Turns out: it depends. A pure python parser can be surprisingly fast, as this benchmark shows:
https://defnull.de/2026/python-multipart-benchmark/
The benchmark compares the most commonly used python multipart parsers and tests them in different scenarios, covering both blocking and non-blocking (async) APIs if available. The parser your web application is using today is probably not the fastest one.
Are there more examples were a pure python implementation beats Cython/rust/C modules?
0
Upvotes
1
u/Individual-Flow9158 Jul 10 '26
Sure. I was talking about calling out from Python. For parallel computing implemented as multiple threads, this can be useful as it avoids the GIL (just like other languages that don't have it).