3 ms·
It's wild how much longer this article was than it needed to be. The first benchmark showed that for the test case tested, the copying and borrowing performed n
by Kapura 7y ago
It's wild how much longer this article was than it needed to be. The first benchmark showed that for the test case tested, the copying and borrowing performed nearly identically. The answer to the stated question is that one is free to use whichever syntax one prefers. I would pick the one with the less-confusing semantics, as less complex code is more likely to be correct.
- outworlder 7y ago> It's wild how much longer this article was than it needed to be. The first benchmark showed that for the test case tested, the copying and borrowing performed nearly identically. The answer to the stated question is that one is free to use whichever syntax one prefers. I would pick the one with the less-confusing semantics, as less complex code is more likely to be correct. Please don't blindly apply this line of reasoning everywhere. For this particular micro-benchmark the results were almost identical. So for this particular piece of code one should apply whatever makes sense. But if you are trying to generalize to other code (or worse yet, trying to come up with a rule), then you need to understand why the code is behaving the way it is. If you blindly trust your benchmarks you become blinded by their implicit assumptions.