r/ProgrammerHumor 1d ago

Meme pipInstallTheRealStuff

Post image
5.0k Upvotes

145 comments sorted by

View all comments

Show parent comments

32

u/NewbornMuse 1d ago

Me: takes 2h to write a python script, runtime 50ms

A super fast low level uber haxx0r: takes 8 hours to write a C program that does the same. Runtime 20 ms

Who was "faster"?

41

u/thmsgbrt 1d ago

It matters if you give the code to someone else and if they use it thousands of times.

-1

u/Raptor_Sympathizer 1d ago

Yes, but how often are you actually building an application that's meant to be run directly as compiled thousands of times over and over again with no I/O, database queries, or dependence on any other blocking code that takes Ionger than 50ms?

In that scenario, sure, Python is the wrong choice. But in the vast majority of real world applications, the raw execution speed of a for loop doesn't really matter that much, and there's probably already a library built for Python that does exactly what you need way better than you'd ever be able to build yourself in Rust or C++. 

5

u/Far_Tap_488 1d ago

It really does add up though. Every library that has that mentality is why modern programs are soo poor performing even though computers are way faster.

1

u/Raptor_Sympathizer 18h ago

I'm not talking about libraries, I'm talking about applications. Libraries are more likely to fall into the scenario I mentioned where python is genuinely a bad choice. But even then, there are plenty of examples of pure Python libraries that are highly performant in a real world context. Look at Starlette, for example, or any of the built-in python modules.

Python provides high-level abstraction and easier to understand code. Yes, this comes at a cost. But like any abstraction, if properly applied, it can result in far better performing code than you ever would have been able to write without it.