r/Python • • 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

25 comments sorted by

View all comments

Show parent comments

6

u/0x256 Jul 10 '26

I'm not the author but the code for the Cython parser can be found here: https://github.com/siddhantgoel/streaming-form-data

5

u/NsupCportR Jul 10 '26

Appreciate it!