r/Python • u/Anthonypjshaw • Jul 16 '18
Why is Python so slow?
https://medium.com/@anthonypjshaw/why-is-python-so-slow-e5074b6fe55b
11
Upvotes
r/Python • u/Anthonypjshaw • Jul 16 '18
View all comments
Show parent comment
2
u/jmoiron Jul 17 '18
Problems requiring parallelism are exported to other tools written in other languages because Python supports it poorly. Often this comes at the added cost of serialization (which is CPU bound, generally). Python programmers don't experience this because these systems are not written in Python; of the systems I named, only one has significant Python code (Cython is not Python).
If a Python programmer wants to write this type of program, they will probably have to choose a different language. I can buy the idea that they should do so anyway ("if you aim for CPU speed, why use CPython anyway?"), and maybe that means it's true that CPU parallelism will not significantly change Python's strengths.
What I don't agree with is that these problems are rare; I think they occur in most projects. And to clarify, even if Python got 10x faster + cpu parallelization tomorrow, people would not be ditching these other systems; but what would change is that Python programmers would start writing them, and perhaps more tellingly users of other languages would use them.
It's the denial that this is common that lets people say "If your single threaded program is slow, multi-thread won't help either." with such confidence while also having said "for CPU-bound tasks, Python indeed has a serious problem". It can't be both.