by mxkopy · 3y ago · 0 comments
This reads like:
From first principles, you should always expect that adding lines of code increases the time it takes to execute and the burden of proof is to argue why it would not.
Just like code, economies can be made more complex, which can increase their efficiency.
I would also argue this is true? Assuming more lines of code directly translates to more CPU instructions
Yes, so the burden of proof is on the algorithm. Adding more lines of code, by default, makes the code slower. If the algorithm is more efficient, it can make the code faster. But it must be more efficient.
This logic seems to hold up to me, but maybe I’m missing something here?
The key is that code isn't running in a vacuum. It's operating on data (or controlling systems, etc). A smaller amount of code may be operating on the data in an inefficient manner, whereas a larger amount may be doing it more efficiently.
In the above talk, this contrast is very stark, because the "more code" version does some stuff and then does the exact thing the "less code" version does, yet is faster.
This kind of thing is common enough (albeit less stark than in the above example), that "less code is faster" is not a great "default" assumption to make.