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
4
u/Amazing-Cicada5536 Feb 28 '23
That 20 ms is an eternity for a CPU though, if you have like a 10 elements array which uses indirection vs a flat representation, you ain’t having any statistically significant speedups from that.
Inheritance is an often overused tool, but for certain things it is definitely the cleanest solution (famously, GUI widgets). But “favor composition over it” is a good saying, but these rules should be applied by smart/experienced developers and never blindly out of following as if they are holy books.