Re:“Clean” Code, Horrible Performance
by lmm on Tuesday February 28, 2023 @06:09PM
(#34976235)
These examples are absolutely a strawman. He's imagining there's one specific access pattern that's executed thousands of times per second. In a realistic codebase you're accessing the data less often but in multiple different (often subtly so!) ways. Cache efficiency is everything for modern CPUs, so you can't "simplify" the access patterns without making your benchmarks unrepresentative.
[ Parent
| on HN ]
How is it a strawman when it's literally taken from a Clean Code textbook?
His benchmarks aren't taken from the textbook. If you benchmarked the textbook's changes in a realistic context you'd get quite different results.