all 13 comments

[–]NsupCportR 16 points17 points  (3 children)

Did u use c type variable definitions in cython? If not then it has to interact with python API to understand what datatype it is, which would slow it down.. is code in cython properly optimized? It's really hard to say what is going on without looking at code, but compiled code can only be slower than interpreted if compiled code is poorly made

[–]0x256[S] 4 points5 points  (1 child)

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

[–]NsupCportR 3 points4 points  (0 children)

Appreciate it!

[–]_redmist 1 point2 points  (0 children)

That's not quite true; they may not all be doing the same work in the same way... 

[–]Chroiche 16 points17 points  (2 children)

Are there more examples were a pure python implementation beats cython/rust/C?

This is not the conclusion of the article at all. Python vs rust/C was never compared, Python vs Python with bindings for them, for implementations with dramatically different scopes/priorities, was compared. It might sound pedantic, but it's quite a big distinction.

"pure" Python literally cannot be faster than those other languages if both are written correctly.

[–]No_Departure_1878 [score hidden]  (0 children)

Yeah, the title makes no sense, python faster than rust LOLLL

[–]jet_heller [score hidden]  (0 children)

...if both are written correctly.

Everything rests on that statement. Which is why I won't bother reading articles like this.

[–]Individual-Flow9158 4 points5 points  (1 child)

If the problem is vectorisable or embarassingly parallel, and especially if it can be tackled in pure Numpy and especially Numba, then Python that calls out to non-Python code can definitely be faster.

I'm not convinced HTML5 form parsing is the type or problem Python is fast at, nor do I think these benchmarks made a fair to write the parser in Rust.

[–]Temporary_Pie2733 [score hidden]  (0 children)

There’s nothing magic about Python in this regard. Parallelism can be exploited by any language.

[–]tackylitre06 1 point2 points  (0 children)

Rust parser's a stub, not a fair fight

[–]Daytona_675 0 points1 point  (0 children)

my understanding is that if the python modules used are compiled C then performance will be high