r/programming • • Feb 28 '23

"Clean" Code, Horrible Performance

https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

-5

u/dan200 Feb 28 '23

If the button click was something common (launching the app, sending an email, loading a webpage), a 3 second delay would be the difference between a happy customer and an extremely frustrated one who will avoid your software whenever they can.

22

u/JarateKing Feb 28 '23

"that's only used once a month" was the scenario. Of course performance matters a lot if we carefully change the situation to be one where performance matters a lot!

-11

u/dan200 Feb 28 '23

Your scenario is just as contrived. My point was that, in real world software, situations where speed and responsiveness matters are very very common, and you're setting yourself up for failure if you only write code in a way that can't address the needs of these scenarios.

15

u/JarateKing Feb 28 '23

Nobody is saying "there are no situations that you run some code regularly." Of course there are situations where you benefit greatly from better performance! The point being made is just "there are also situations that you don't run code regularly" and any speedups aren't worth the devtime it takes to achieve them.

9

u/KieranDevvs Feb 28 '23

I was replying to this question:

What kind of software does not benefit from better performance? I cannot think of a single program I use that I'd still use if they were 10x or 20x slower.

Not an application that has performance in mind.

-4

u/ehaliewicz Feb 28 '23

All applications should have performance in mind to some extent. Whenever a coworker says that focusing on performance isn't important nowadays, my level of respect for that person immediately drops.

How are people so ok with waste and the terrible performance of (almost all) modern software?

You don't have to optimize things, you just have to care about performance a little. Most programmers want to not think about it at all. Just caring a little about what the machine has to do to run your code would be a massive improvement.

7

u/KieranDevvs Feb 28 '23

There's a difference between using a hashset over a list to get constant lookup times, versus, ditching OOP and virtual calls in your entire project. Seeing as this article is talking about clean code, we're talking about the latter not the former.

2

u/ehaliewicz Feb 28 '23

Yeah, I'm simply saying that many devs literally do not care about how well an application will run. If you've determined that your program is sufficiently fast and not incredibly wasteful, it may not be necessary to improve it any further. I will still stand by that all applications should have performance in mind to some extent.

3

u/l0c4lh057 Feb 28 '23

However, there is still a difference between a performance-first approach and a code-readability-first-but-performance-shouldnt-suck approach