3 ms·
I make defensive copies when I'm worried about it. Append will reuse the current backing array when it has enough capacity to hold whatever you're appending. S
by oconnor663 9y ago
I make defensive copies when I'm worried about it.
Append will reuse the current backing array when it has enough capacity to hold whatever you're appending. So to alias maximally like you suggested, you could try creating all your arrays/slices with lots of extra capacity. That would be pretty expensive, but you could try doing it one-off just to see what happens in your test suite?