MIT Technology Review: An Interview With Bjarne Stroustrup
Sean Kelly
sean at f4.ca
Tue Dec 5 13:38:16 PST 2006
Pragma wrote:
> zz wrote:
>>
>> Conclusions:
>> D is great, but DMD will have to do something about it's performance
>> for some applications.
>
> I tend to agree. D's array allocation algorithm, as well as it's GC
> behavior, are great for most cases. But they can fall flat in certain
> cases - of course that's true of any algorithm really. :)
>
> While I'm no STL guru, I have to ask: which allocator were you using
> with ptr_vector?
>
> I know that with D, pre-allocating data for arrays can make a big
> difference if you expect to perform a lot of concatenations - especially
> with atomic elements like pointers or references.
I still find this confusing. The GC uses "power of two" sized blocks up
to page size where the grow strategy kicks in, so it should already be
using "double my current size" allocation behind the scenes. But I
suppose I should really spend some time testing this to see if it can be
improved. One slightly crazy idea that's been kicked around is to allow
the user to override the default grow strategy, but that only seems
useful if the default one really isn't appropriate for most situations,
and I'm hoping that testing plus perhaps some tweaks to the algorithm
will obviate the need for this.
Sean
More information about the Digitalmars-d
mailing list