DIP 1025--Dynamic Arrays Only Shrink, Never Grow--Community Review Round 1

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Nov 11 22:53:29 UTC 2019

On Monday, 11 November 2019 at 21:54:23 UTC, Jonathan M Davis 
> Both ~ and ~= use the GC, and it should be obvious that they 
> do, since they can't work if they don't. Using ~ isn't any 
> clearer than ~=, and ~ has worse performance when a dynamic 
> array is able to grow in-place.

a~b is easier to deal with in code analysis than a~=b because the 
latter has unknown aliasing properties.

The compiler knows more when you can either say "will always 
reallocate" or "will never reallocate".

An optimizer could always do it in place if it is known to be 
safe. Especially in a loop or in a series of concatenations.

More information about the Digitalmars-d mailing list