3 ms·
In many cases you might need to make two copies. Also remember, the author proposes to change the abi to encourage pass by value instead of of pass by restricte
by gpderetta 6y ago
In many cases you might need to make two copies. Also remember, the author proposes to change the abi to encourage pass by value instead of of pass by restricted reference, so in the original code there might be zero copies.
In practice this optimization would be very fragile (like most optimizations relying on escape analysis) and people would keep passing by reference in fear that a small change like taking the address of an object might force a copy of a large struct.