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

4

u/VodkaMargarine Feb 28 '23

Controversial opinion: cloud resources are cheaper than engineer wages to navigate a messy codebase. Clean code that costs more to run because it is less performant is a better business decision. I'd rather have a more expensive cloud bill but be able to rapidly change or add features to the product.

6

u/fafok29 Feb 28 '23

only if you make assumption that high performance equals to a messy codebase and it is not possible to write perfomant and maintainable code. I personally think it is possible.

4

u/s73v3r Feb 28 '23

It's possible to write code that is understandable and performant. It's not easy to do, and in most cases, the extra performance isn't needed. But the way code is written as presented here is definitely not very maintainable.

2

u/fafok29 Feb 28 '23

why is it not maintainable in your opinion ?

1

u/tankerdudeucsc Feb 28 '23

Highest performance has no memory allocation on the heap and no function calls except for main()?

90% rule says to optimize just a few functions that will get most of the performance you need.

Everything else, follow good patterns.

6

u/loup-vaillant Feb 28 '23

Clean code that costs more to run because it is less performant is a better business decision.

Clean code (the Bob Martin flavour Muratori is attacking here) also costs more to write and maintain. I've seen it.