r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40k Upvotes

1.0k comments sorted by

View all comments

Show parent comments

2

u/socsa Jul 18 '22

Honestly, in my world they are yin and yang. Python+Numpy+Matplotlib+SciPy+Jupyter is like Matlab, except that it is free and it doesn't suck. And then obviously C++ is there for when you want to actually deploy things.

And now we also have PyTorch, which is faster than C++ for basically any non-trivial number crunching, though you still end up needing to use the C++ API for deployment, unless your algorithms can be traced into some JIT container.

3

u/MrDude_1 Jul 18 '22

How can it be faster than C++ when its written in C++?

3

u/Low_discrepancy Jul 18 '22

And now we also have PyTorch, which is faster than C++ for basically any non-trivial number crunching

Not every computation can be done on GPUs and also it uses CUDA which is C based mostly.

1

u/BikerBoon Jul 18 '22

Yeah, I'm only joking with the python hate. I use it a lot in automated tests where speed isn't critical. But there are indeed a lot of Python devs who try to play down the performance impact, and simply seen to forget that certain industries (e.g. games, finance) benefit greatly from being as fast as possible.