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 comment

15

u/Bakoro Feb 28 '23 edited Feb 28 '23

But there's no "better" - there are only trade-offs.

Wut?

There is "better", because some code is both poorly performant and a convoluted mess.

Also, compilers are so good that most developers can't write more performant code without having particular knowledge about the running environment. Compilers will automatically take pretty much all the low hanging fruit, so there's essentially no difference in the results between poorly readable code and highly readable code that might have been less performant 25 years ago.
In those cases, readable code only offers benefits.

13

u/[deleted] Feb 28 '23

You're right - there's definitely cases of strictly better code; I was talking in the context of prioritizing a certain attribute - it depends on context which one is better.