Array append performance

Christopher Wright dhasenan at gmail.com
Sun Aug 24 17:09:13 PDT 2008


superdan wrote:
> wake up people. there is first the problem capacity can't be implemented. u gotta figure out some approximation first. then discuss the gorram ifs.

Capacity could be implemented by preallocating extra space at the end of 
an array, but aside from that, you're right; the garbage collector could 
use memory between the end of the array and the end of its capacity 
after the array was created, and there's no way you could update all the 
references to that array and change the stored capacity.

As for slices, the capacity of a slice would be equal to its length, so 
that isn't an issue.



More information about the Digitalmars-d mailing list