AA clear property

Alex_Dovhal alex_dovhal at yahoo.com
Sun Nov 6 03:39:27 PST 2011


"Marco Leise" <Marco.Leise at gmx.de> wrote:
> No way I heard of. You could delete the entries one by one. :D
> I guess setting all references to null is the easiest way to 'clear' an 
> AA.
Thanks. I tried both of them in small benchmark. Results are
(1) fill_values(aa); aa = null
(2) fill_values(aa); aa.remove(...)
For both methods time1/time2 is around 35/52, with aa size 10, 100, 1000, 
and 10000.
Interesting enough, with aa size 1M, 10M, 100M time1/time2 is around 1/1.
So (1) is prefered for 10-1000 elements situation i have, but it allocates 
memory each time :( while 2 reuses it, IMHO. 




More information about the Digitalmars-d-learn mailing list