"Clean" Code, Horrible Performance (2023)
- Programming
- Performance
- Developer Tools
- Software Engineering
The post revisits Casey Muratori’s critique of Robert Martin’s Clean Code style by walking through a shapes example and showing how common OO advice can turn a straightforward data-and-switch design into code with extra indirection, worse cache behavior, and much lower throughput. The core claim is not just that virtual dispatch is slower, but that several popular habits often travel together: hiding data behind layers, splitting logic into tiny methods, preferring polymorphism over explicit branching, and structuring code around abstract responsibilities instead of the machine’s actual data flow. In the article’s framing, those choices can make code slower by construction, not just in edge cases.
Treat “clean code” rules as local heuristics, not architecture. If a path is hot, design around data layout and control flow early, then spend abstractions only where you have a real change boundary or multiple concrete implementations.
-
computerenhance.com
- Discuss on HN