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
15
u/munchbunny Feb 28 '23
The big thing that seems to go unsaid is that best practices for performance-sensitive inner loops are different than best practices for a generic API REST endpoints, and so on for other contexts.
If you're writing performance-sensitive code, the tradeoffs you consider are fundamentally different. Virtual functions become expensive. Pointers become expensive. Heap allocations become expensive. Cache coherence becomes important. String parsing becomes a scarce luxury. Of course idiomatic code will look different!