3 ms·
Although your point is sort-of true, but I don't really see how it's valid here. The author is talking about the performance implications of the two approaches
by HereBeBeasties 7y ago
Although your point is sort-of true, but I don't really see how it's valid here. The author is talking about the performance implications of the two approaches in situations where the function parameters are not mutated. Suggesting that user "makes the choice" here by taking defensive copies for themselves will probably (but who knows what the optimisers will do - they might just elide it) make performance worse. It's not something end users will think to do, anyway, at least not in the name of performance.
Regardless, I want a library author to help me fall into the pit of performance success, not expect me to do it all for myself.