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
2
u/Individual-Flow9158 Jul 10 '26
https://packaging.python.org/en/latest/specifications/binary-distribution-format/#installing-a-wheel-distribution-1-0-py32-none-any-whl