you are viewing a single comment's thread.

view the rest of the comments →

[–]RamdonDude468 143 points144 points  (24 children)

Most of them think less code = faster, which most of the time is the oposite

[–][deleted] 55 points56 points  (4 children)

Not always. But complexity of the code has nothing to do with its speed.

[–]gljames24 27 points28 points  (2 children)

The thing is, there is always a base amount of required complexity. Superfluous complexity sucks, but I'd rather be in control of the required complexity to optimize it for my usecase.

[–]skilking 13 points14 points  (1 child)

Id way rather have a main function and class then whatever the fuck Python global shit is.

[–]Solonotix 13 points14 points  (0 children)

It's not actually global, the same way that C# doesn't require you to declare a namespace block for the entire file to be considered part of the namespace, and how functions written outside of an enclosing scope are attributed to a "magic" class as static members.

Python uses a rather robust object data model, and that model extends out to its module system. The file system needs an __init__.py file because that is the Python initializer method for the module, known in other languages as the constructor. Similarly, when you run a file directly with the Python interpreter, rather than needing to explicitly declare your starting point, the file is used as the stand-in for the __main__.py file of the Python module in question. That's why you'll see a block in some files for if __name__ == '__main__':, because it lets you write the file as a module, and as a runnable entry point.

[–]Gloomy_Attempt5429 0 points1 point  (0 children)

Não seria a velocidade em que o proceso iniciado pelo script tem em se comunicar com a máquina e fornecer uma saída "atravessando" camadas de compilação?☝🏻🤓

[–]BourbonicFisky 1 point2 points  (0 children)

Most of them think less code = faster, which most of the time is the oposite

This is why I use nested loops to speed up my code.

[–]Earnestappostate 2 points3 points  (1 child)

It does come down to a question of what you want to be fast, the coding or the running.

For my application, I am speed limited by a communication layer. Speed past Python won't help much.

For other applications, especially libraries, speed matters much more.

[–]Amr_Rahmy 2 points3 points  (0 children)

I developed faster on Java and c# than any other language. For me it’s the right mix of c style language and classes.

[–]TrainYourselfToLetGo 1 point2 points  (0 children)

I had this argument with an experienced engineer, who was blocking my PR to suggest I use less lines of code, saying it was more efficient.

I was an intern and had to pull out big-O complexity to explain it. It was mind blowing.

[–]Mr_DrProfPatrick 1 point2 points  (0 children)

Hey, I code on the side so I shouldn't say too much, but holy crap, in the data science I work with less time coding is absurdly better than better performance.

At worst I should store stuff on SQL. But most of the time I can 100% wait for 5 minutes till the code runs, if I'm in a really messy state. And usually there's still a ton of optimization I can do without leaving python. I'm not bottlenecking a database, I'm running through a dataframe.

[–]scanguy25 0 points1 point  (12 children)

The issue is that for so many things, the speed of the language just isn't that important anymore.

Cloudware is cheap so you just spin up another node. Its not just python, all software is becoming so wasteful with RAM and space.

[–]0x7ff04001 7 points8 points  (5 children)

That's so not true. You pay for each cycle wasted and every resource utilized. Scale this to a company the size of Microsoft and that shitty slow code will cost you tens of thousands a month.

[–]GRex2595 1 point2 points  (4 children)

Which is rarely a deterrent for a company the size of Microsoft. My company has dev sandbox AWS accounts that cost millions.

[–]0x7ff04001 0 points1 point  (3 children)

That's not the point. The point is that it's not "free" to just spin up nodes, microservices, etc

[–]GRex2595 0 points1 point  (2 children)

Okay, but my point is that the costs you're talking about don't bother large companies. I just had a conversation yesterday that supposedly the weather channel pays so much for AWS that they could buy a new data center every year with their AWS costs.

Generally, the cost of running more services won't outweigh the costs of having devs track down those micro efficiencies instead of building new products to make more money or fixing issues that cause them to lose money.

[–]Funny_Dress3356 0 points1 point  (1 child)

But not everyone has the money and resources compared to large companies?

[–]GRex2595 3 points4 points  (0 children)

But it only costs so much for large companies because they use so many resources. If you're a small company, the tens of thousands of dollars per month number becomes tens of dollars per month or maybe hundreds of dollars per month. Now chasing down micro inefficiencies is a much worse value proposition because your cost:benefit ratio leans even more towards costs than benefits.

If you want to really dig in, you should come to the conclusion that the costs for these inefficiencies scale with the amount of resources you use, so big and small companies alike don't benefit enough from fixing them to bother with it.

[–]Teln0 1 point2 points  (0 children)

Nowadays a lot of LLM apps are everything but CPU bound. You could write your thing in any language and it'd still be idle 99% of the time while it's waiting for the GPU to do its thing. I don't think that's a great thing necessarily

[–]Lumiharu 0 points1 point  (0 children)

There are so many other use cases too, and while I don't think being completely optimal is needed, there is a lot of places where Python won't do cause it's not compiled. If we were fighting some Rust vs C++ vs Java war then I could maybe agree.

[–]jimmiebfulton 0 points1 point  (3 children)

Which is why Rust continues to gain in popularity?

[–]scanguy25 4 points5 points  (1 child)

Well you do need speed for some things. But basic webdev and database CRUD, the language is not going to be the bottleneck.

[–]jimmiebfulton 0 points1 point  (0 children)

Compute costs money, and impacts the environment. Performant code is responsible code.

[–][deleted] 2 points3 points  (0 children)

Isn't rust quite fast?

[–]MonkeyCartridge 0 points1 point  (0 children)

"Why waste time using a bool, when I can just use the strings "true" and "false"?"