Paralysis of analysis

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Dec 15 11:18:20 PST 2010


On 15.12.2010 3:50, Jonathan M Davis wrote:
> On Tuesday, December 14, 2010 16:35:34 Craig Black wrote:
>>> What say you?
>> I feel like the odd man out here since my perspective is so different.  I
>> use custom container classes even in C++, partly because I can usually get
>> better performance that way, and because I can customize the the container
>> however I like.  So I will probably be doing my own containers if/when I
>> use D.
>>
>> Beyond that, my own personal preferences seem so different that I hesitate
>> to mention them.  I use dynamic arrays by far the most out of all container
>> classes.  I use them so much that I cringe at the thought of allocating
>> them on the GC heap.  My code is very high performance and I would like to
>> keep it that way.
>>
>> Also, my usage of arrays is such that most of them are empty, so it is
>> important to me that the empty arrays are stored efficiently.  Using my
>> custom container class, an empty array does not require a heap allocation,
>> and only requires a single pointer to be allocated.
>>
>> Not sure if these requirements are important to anyone else, but I don't
>> mind making my own custom containers if I need to.
> Dynamic arrays are already on the GC heap...
>
> - Jonathan M Davis
Hm,
((T*)malloc(1024*T.sizeof))[0..size];
works. Just needs careful initialization of each field, since they are 
filled with trash ...
And you can even do slicing. Just don't append to them and keep track of 
the initial reference ;)

-- 
Dmitry Olshansky



More information about the Digitalmars-d mailing list