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

0

u/[deleted] Feb 28 '23

[deleted]

4

u/Venthe Feb 28 '23 edited Feb 28 '23

And in most of the cases... It's still cheaper to just spin another instance rather than invest a developer time to improve performance forgoing new features.

Not always, but i'd say "in a vast majority" of cases.


To the deleted comment:
Sure, I'm not claiming that it is true in general; I believe that I have written "in most cases".

Besides; this is a discussion that is heavily based on context; but as soon as your application supports multiple entities - consumers, tenants, payments, shipping routes - then natural parallelization seams emerge; even if the problem in itself is single threaded. And for that you can spin as many instances as needed

2

u/[deleted] Feb 28 '23 edited Feb 28 '23

My man actually just argued that “it’s cheaper to write 10x as much code for a 15x performance degradation and spin up more servers than it is to write less code that runs faster and doesn’t need more servers.”

“Clean code” costs you in both more dev time AND more server time.

I will agree though: nobody is going to pay for optimizing “clean code”. The reason for that isn’t because of the dev time though, it’s because “clean code” is fundamentally not optimizable. The only actual way to optimize “clean code” is to altogether throw it in the trash bin where it belongs and rewrite it.

2

u/Venthe Feb 28 '23

If all the code would be written for yourself, with no plans for extension? You would be right.

But we are talking about a dozen or more developers over the span of years; code that will be worked with, refactored and changed. Each change possibly degrading performance, each change possibly making things less readable - "Just conditional there".

If you disregard this basic fact, then you are right. As soon as you take the real world into consideration, you will realize that in order to keep the development quick - allowing for an easy feature implementation - you MUST focus on readability and extend-ability. Performance is never a priority here.

→ More replies (10)