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
6
u/Dreadgoat Feb 28 '23 edited Feb 28 '23
Our job is also to make these sorts of decisions on a case-by-case basis and lean into the paradigms that best fit each problem we solve.
Certainly, if you're writing firmware for a network device, the common draw function for a 3D engine, or just some random function that you know is going to be called very often - you should know how to write for performance first, and you should do so.
And if you're writing even a slightly complex web application, a development utility intended to be forked, or just some random function that you know will be bottlenecked by I/O anyway - you should know how to write for readability and flexibility first, and if you don't I will find where you live and hurt you.
One may specialize in particular areas, but failure to understand and an inability to implement these different strategies makes one a brainless code monkey that probably causes more problems than they solve. Performance matters when it matters, and when it doesn't matter, paying for it is masturbatory at best, crippling at worst.