3 ms·
> That's exactly what happens: a Rust "move" is under the covers a memcpy(). Not exactly. The Rust compiler is usually pretty smart about optimizing out memcpy
by MetaDark 6y ago
> That's exactly what happens: a Rust "move" is under the covers a memcpy().
Not exactly. The Rust compiler is usually pretty smart about optimizing out memcpy for most moves.
For example when returning a large struct from a function, the optimizer could add an "out" reference parameter to the function and the function would directly initialize the return value into that reference.