Pop quiz [memory usage]

Sean Kelly sean at invisibleduck.org
Sat Jun 6 12:03:03 PDT 2009


bearophile wrote:
> Sean Kelly:
>> Particularly in D2 where append 
>> operations on arrays are probably less common as a result of string 
>> being invariant.
> 
> They aren't much common maybe because they are currently dead-slow. Appending to an immutable string is a common operation. But I guess Array appenders will get more common...

Yes but appending to an immutable string is never performed in place, 
which is the only time the extra space reserved by newCapacity matters. 
  I suspect the memory wasted by newCapacity is more of an issue than 
any time savings it provides.



More information about the Digitalmars-d mailing list