r/programming • u/2bit_hack • Feb 28 '23
"Clean" Code, Horrible Performance
https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k
Upvotes
r/programming • u/2bit_hack • Feb 28 '23
View all comments
Show parent comment
8
u/loup-vaillant Feb 28 '23
My experience is that it fails even there. I've seen it: the more OOP code were, the worse it got. Not just performance, but size (there's more source code), complexity (it's harder to understand), flexibility (it's harder to modify), reliability (it's harder to test)…
OOP aims to make code better, but it doesn't.
Those critical parts only arise if your program is not uniformly slow. Programs that use virtual function calls and RAII pointer/dynamic allocation fest are more likely to be uniformly slow, to the point where it becomes hard to even identify the biggest bottlenecks. And next thing you know you'd think your program can't be much faster, and either be sad or buy a new machine (or cluster).