Are AAs broken? (Was: Why isn't bool allowed as AA key type?)
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jun 2 03:27:42 PDT 2011
On Thu, 02 Jun 2011 06:21:28 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:
> Steven Schveighoffer wrote:
>> There is always dcollections (has both Hash- and TreeSet). It is boost
>> 1.0, so feel free to steal anything to propose for std.container (in
>> fact,
>> RedBlackTree is from dcollections). Note that I'm nowhere near an
>> expert
>> on hashing, so I'm not sure how it will perform against AAs. I know it
>> does beat them using my custom allocator, but that's not a truly fair
>> comparison -- AA's could be written with a custom allocator too.
>>
>> -Steve
>
> Well, how? Since an 'in' expression returns an internal pointer into the
> AA for
> value types, they cannot do better than to rely on GC.
> This rules out heavy AA use for real-time applications. I think AAs are
> broken.
What is the issue here? Are you saying you can use the pointer after
destroying the element, because you can't. AA's free an element when it
is removed.
BTW, dcollections' custom allocator does use the GC, it just uses it in
bulk instead of allocating for each node.
-Steve
More information about the Digitalmars-d
mailing list