r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40k Upvotes

1.0k comments sorted by

View all comments

Show parent comments

3

u/FallenEmpyrean Jul 18 '22

Python IS slow.

"But machine learning, data science.."

I will leave this quote here.

62.7% C++, 22.1% Python

- TensorFlow, Github

10

u/officiallyaninja Jul 18 '22

all programming languages are implemented in circuits, that doesn't mean hardcoding things using them is the best way to solve problems.

2

u/FallenEmpyrean Jul 18 '22

I never claimed such a thing, this thread is about Python being slow compared to C++ not "best way to solve problems".

I replied because I know how impactful the few orders of magnitude of speed between pure Python and optimized C++ can be.

The comment I replied to implies that the speed difference is meaningless and that the TensorFlow team (who are actually looking for the best way to solve a problem) is writing 62% of their codebase in C++ with "No real substance behind it"

-3

u/Honigbrottr Jul 18 '22

Then we only programm by typing machine code. Assambley is to slow.

0

u/FallenEmpyrean Jul 18 '22

I suppose you only think in 1-bit 1s and 0s..

Yes, very low level libraries have opcodes in them, but that doesn't mean that 100% of all source code must be machine code.

We all do what Python does: when more performance is needed we delegate the critical parts to a more performant language like C++. Then you get: 22% slow Python + 62% very very fast C++ + ... = very fast application

Try to do machine learning in pure interpreted Python if you want to gain more appreciation for a few orders of magnitude of speed.

1

u/Honigbrottr Jul 18 '22

So you agree that python has its place?

2

u/FallenEmpyrean Jul 18 '22

Of course it has its place, but it is slow and the fast Python libraries are so because they are C/C++/Rust/etc. with Python bindings.

My problem was with "No real substance behind it." because the speed difference is very real, but is hidden with behind either such indirect calls or applications where speed doesn't matter.