Arc.Tango

Bill Baxter dnewsgroup at billbaxter.com
Sat Sep 8 08:54:14 PDT 2007


Sean Kelly wrote:
> Bill Baxter wrote:
>>
>> Have you (or anyone) tested the performance of the tango containers? 
>> I'm concerned about the performance impact of all iterators being 
>> heap-allocated, interface-accessed things, but I suspect there are 
>> ways to work around that (maybe using opApply's or scope'ing iterators).
> 
> I /really/ want a chance to work on containers someday soon, but I'd 
> like to preserve the interface aspect for a few reasons:
> 
> * It makes the Tango implementation a framework to build on rather than 
> a reference set of containers.
> * Following from the previous point, it separates the container library 
> interface from its implementation.
> * It allows for Java-style (ie. runtime) container access as well as 
> C++-style (ie. template-oriented) container access.

But it does it allow the C++-style currently? It seems like currently 
the containers themselves have access to a way to instantiate a concrete 
iterator and bypassing the interfaces, but not the outside world. 
There's no generic alias for a containers concrete iterator type, for 
instance, and no function that returns an object of the actual concrete 
type rather than an interface pointer.  At least I didn't notice any.


> If structs are used as iterators there would be no way to prevent their 
> being copied, and some things which could be described as iterators 
> should not really be copyable (input iterators, ODBC cursors, etc). 

I think D2.0 is going to give you a way to have some code run after the 
element-wise copy, so you could throw an exception there for the 
iterators that shouldn't be copyable.  Maybe even a static assert.  But 
that's not much help today.

> Also, there may be some merit in having iterator interfaces as well. But 
> perhaps the virtual function calls here would be prohibitively 
> expensive.  I would be interested to hear opinions on performance 
> requirements related to this.

Don't your iterators already have interfaces?
You must mean something different from what I think you mean.


--bb



More information about the Digitalmars-d-announce mailing list