4 ms·
That's a fascinating observation. Do you think code inherently gets "worse" as it becomes more "optimised"?
by blowski 4y ago
That's a fascinating observation. Do you think code inherently gets "worse" as it becomes more "optimised"?
- dchest 4y agoYes, as it becomes more complicated, catching more edge cases, it becomes less readable. On the other hand, as the compiler improved, some parts of it became more readable (e.g not manually unrolling loops, avoiding manual inlining, introducing bit-manipulation functions into the library instead of repeating them everywhere). Unfortunately, it's unavoidable — faster code is usually longer and more complicated.
- marginalia_nu 4y agoIf you plot difficulty to read against optimization, I'd expect to find a u-shape relation between the two. When code is easy to read, it's easy to find and clean up redundant operations, which naturally makes it faster. On the other end there's some optimizations that require dealing with lower abstraction levels and additional special cases.