3 ms·
The call stack is cheap, its your mental stack that you should be trying to optimize for. Any label over a set of operations (even a single expression) will red
by hackinthebochs 13y ago
The call stack is cheap, its your mental stack that you should be trying to optimize for. Any label over a set of operations (even a single expression) will reduce the mental load necessary to understand an operation, assuming its reasonably named. Managing a stack is what computers are good at. Lets optimize our code for how we can better comprehend it--at a consistent level of abstraction with the fewest amount of level changes as possible.
- mrbrowning 13y agoOh, I wasn't trying to make a claim that this would result in any noticeable performance degradation in the vast majority of cases, but as a means of making code more understandable this particular example suffers in comparison to a comment: less code is on the screen, it requires the reader's eye to jump elsewhere, and again that particular expression is simple and about as easily understood as the function name that replaced it. I think we agree on what to prioritize in writing code, but I don't think that example in the article was a good demonstration of those priorities in practice.