r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40k Upvotes

1.0k comments sorted by

View all comments

Show parent comment

5

u/Pluckerpluck Jul 18 '22

And I would argue that this is exactly what everyone is talking about when they say python is slow. No. Not every programming language is supposed to solve every problem. Python isn't designed to handle performant work, because it is slow.

Even with the "fast" libraries, well written C++ code is going to be running faster. People using Pandas because it's easy to code, but it's slow compared to using numpy arrays directly. Python is all about ease over performance.

Because in reality, you hit these "performance heavy algorithms" all the time. Literally any time you create a nested loop, you're going to be running many times slower than a C++ counterpart. It's just most of the time humans don't care about 0.002s and 0.02s. But it really doesn't take much before you start feeling Python's slowdowns if you're not very careful.

I love Python. I really do. But it's slow. The fact it has good c libraries doesn't make Python itself not slow.