Yet another strike against the current AA implementation

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Apr 26 19:31:10 PDT 2009


Christopher Wright wrote:
> Andrei Alexandrescu wrote:
>> 2. I haven't measured, but the cost of the indirect call is large 
>> enough to make me suspect that opApply is not as efficient as it's 
>> cracked to be, even when compared with an iterator.
> 
> When you know the type beforehand or can use templates, that is, rather 
> than wrapping your range struct in a wrapper class. If you can't use a 
> template for whatever reason, ranges are going to suck -- three virtual 
> calls rather than one.
> 
> I don't usually care sufficiently about performance to worry about 
> whether a call is virtual or not, but you brought that issue up before. 
> And I imagine that, most of the time, you will know the range type in 
> advance.

Yah, that's a good motivation to change how hashes are currently 
handled. But above I was referring to the cost of opApply's callback, 
which adds to the costs you mention.

Andrei



More information about the Digitalmars-d mailing list