Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

How about those new containers?

Posted: 06/20/08 00:38:11

Larsivi wrote: """ Several issues with the original collection package have been identified over time, in particular with functionality. This lead to a new implementation, now available in trunk as the package tango.util.container. It should be more complete when compared to the old one, and in addition the new container package looks to be extremely fast and memory efficient.

The old collection package will be deprecated prior to Tango 1.0. """

Can anyone elaborate on what "issues" were identified? How does the new implementation differ from the old? Is the interface the same? Is it backwards compatible? Almost backwards compatible?

...etc.

Author Message

Posted: 06/20/08 07:05:54

Well, most of the issues has been posted as tickets by you ;)

But "too Javaish" and restrictive iterators were two of them (off the top of my head).

I can see that "more complete" is in the eye of the beholder - as there are a couple of the old interfaces that aren't readily available in the new package. This is meant to be remedied though. There are a couple of new types that aren't in the old, such as Stack.

The new implementation is leaner so to speak, simpler model with shallower hierarchy. The implementation and interface should now be as D as it gets. It has custom allocators and can perform much faster with much lower memory usage.

The new and old containers are not directly compatible, but for the types that are comparable they shouldn't be entirely different eitehr.

Posted: 06/21/08 13:29:22

Great. That all sounds excellent. Looking forward to kicking the tires at some point.

Maybe the old containers should be released under a different package name, though? I think Frank was taking advantage of the Java-like nature of the original Tango container classes in his porting of SWT. Guess he can speak for himself, though.

Posted: 06/22/08 17:27:45

Can't wait until you try them, you're good at spotting issues ;)

We'll put the old collections somewhere, maybe tango.scrapple or similar, we'll see.

Posted: 07/07/08 16:31:28 -- Modified: 07/07/08 16:37:15 by
eldar

hi) I wanna use associative arrays and I read about new containers implementation - tango.util.container, since I'm a newby - where can I find manual or tutorials on how to use them.

Posted: 07/07/08 20:16:44

Hi eldar :)

The new containers have little documentation yet, since they are brand new. ChapterStorage is for the old collection package (still available) and should tell you quite a few things still useful though.

Posted: 07/08/08 09:05:14

thank you :) for now I'm using standart D assotiative arrays - I need to make a decision - which is better for me.

Posted: 07/08/08 09:52:11

The builtin AA's are surprisingly slow for some cases, so if you can, you should benchmark to see what fits best for you. In particular the alternative allocators for the Tango containers seems to be very efficient.

Posted: 07/25/08 07:52:07

Hi! I faced the fact that I need something like std::vector from C++. What module from util.Container is most suitable for it? util.more.Vector as far as I understood cannot increase it's initial size.

Posted: 07/25/08 09:23:24

The built-in dynamic arrays?

I think they perform fine, although controlling the allocations yourself (by setting .length) can speed them up. But this is really off topic...

Posted: 07/27/08 00:13:53

And tango.core.Array makes the built-in arrays pretty powerful, in my own biased opinion :)