MIT Technology Review: An Interview With Bjarne Stroustrup

Pragma ericanderton at yahoo.removeme.com
Tue Dec 5 14:02:31 PST 2006


Sean Kelly wrote:
> 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, I'm pretty sure you've seen this before.  But just in case:

http://svn.dsource.org/projects/ddl/trunk/ddl/ExpContainer.d

It might give you (or others) a head-start along that path.


-- 
- EricAnderton at yahoo



More information about the Digitalmars-d mailing list