Dtnamic array memory allocation

bearophile bearophileHUGS at lycos.com
Fri Jan 8 00:54:50 PST 2010


Rob Adelberg Wrote:
> Does the dynamic array pre-allocate any memory?

It doesn't preallocate, and currently array appending in D is a slow or very slow operation.
If you need to speed it up, you can use a struct that performs this operation in a faster way, that's available in D2 in the Phobos, and in D1 can be found around (I have a version too for D1). Something like an Appender or ArrayBuilder.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list