[rust-dev] &self/&mut self in traits considered harmful(?)

Cameron Zwarich zwarich at mozilla.com
Sun Jun 22 14:18:13 PDT 2014

On Jun 16, 2014, at 3:19 PM, Patrick Walton <pcwalton at mozilla.com> wrote:

> On 6/16/14 3:17 PM, Cameron Zwarich wrote:
>> I stated the right case, but the wrong reason. It’s not for
>> vectorization, it’s because it’s not easy to reuse the storage of a
>> matrix while multiplying into it.
> Wouldn't most matrices be implicitly copyable (and thus optimized--or at least optimizable--into by-ref at the ABI level)?

Sorry for the super-late reply, but if you reuse the same argument multiple times, you will have made multiple copies of it, right? A sufficiently optimizing compiler would probably be able to optimize it if everything is inlined.

However, that also only applies to dense matrices. Sparse matrices are unlikely to be Copy.


More information about the Rust-dev mailing list