3 ms·
Clean code makes it easier to find high level optimisations which can improve the order of performance, not just shave off a few percent.
by taneq 4y ago
Clean code makes it easier to find high level optimisations which can improve the order of performance, not just shave off a few percent.
- nayuki 4y agoIt's true. It's easier to make mathematical connections with algebra, combinatorics, etc. when you're reading short formulas and not being not knee-deep in hand-written SSE asm.
- thethirdone 4y agoFrom: https://www.computerenhance.com/p/clean-code-horrible-performance https://www.computerenhance.com/p/clean-code-horrible-perfor... > The speed differences range from 20-25x — and of course, none of the AVX-optimized code uses anything remotely like “clean” code principles. If clean code limits your default performance to 20 times worse, those high level optimizations might not even be worth it.
- microtherion 4y agoThe point is, without a reasonably clean starting point, you'll never get to apply those 20-25x optimizations in code bases beyond a certain size, because they've become a wasteland of mediocre micro-optimizations before you even get started. So the sensible thing to do is to identify a component of manageable size, fence it off with suitable abstraction boundaries, and then apply optimizations WITHIN the confines of that component only.
- taneq 4y agoIf your performance-critical code is 25x slower than it could be, while using the same algorithm, it’s not “clean”, it’s just bad.