|
|
|
|
|
by marcandre
746 days ago
|
|
I'd love examples where DRY can really hurt performance. Typically what matters most in terms of performance is the algorithm used, and that won't change. More importantly, cleverer people than me said "premature optimization is the root of all evil" |
|
If you want a specific example look at something that needs to be performant, i.e. in those 3%, let's say OpenSSL's AES implementation for x86, or some optimized LLM code, you'll see the critical performance sections include things that could be reused, but they're not.
Also the point Knuth is making is don't waste time on things that don't matter. Overuse of DRY falls squarely into that camp as well. It takes more work and doesn't really help. I like Go's proverb there of "A little copying is better than a little dependency."