why does array appending add a page size instead of doubling ?

Steven Schveighoffer schveiguy at yahoo.com
Sun Feb 3 03:57:06 PST 2013


On Sat, 02 Feb 2013 23:37:10 -0500, Ali Çehreli <acehreli at yahoo.com> wrote:

> Rather, a better growth factor is 150%. It has been shown that 150%  
> growth factor works much better with memory allocators.

in fact, D's appender uses something more than doubling.  I did not write  
that part (though I did massage it for optimizations), so I don't know the  
rationale behind it or how it is designed to work, but the code is here:

https://github.com/D-Programming-Language/druntime/blob/master/src/rt/lifetime.d#L1651

-Steve


More information about the Digitalmars-d-learn mailing list