questions on PhanTango 'merger' (was Merging Tangobos into Tango) - long-term vision

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Sat Oct 13 11:11:25 PDT 2007


BCS wrote:
> Reply to kris,

>> Chained calls actually cost /less/, since the dispatch is decided at
>> compile-time rather than runtime. In other words, chained-calls don't
>> have to go through a big switch statement to figure out the type and
>> dispatch based upon that. Thus, purely from a runtime cycle-count,
>> chained calls really /are/ more efficient (for the kind of thing we
>> are talking about). This is one of the reasons why Tango uses chained
>> calls in some aspects of the IO model.
>> 
>> :p
>> 
> 
> interesting. I would say this indicates a defect in something. Either the
> implementation of switch or the TypeInfo stuff. The number of different
> choices that writef has to chouse from is only around a dozen or so. I
> would expect that the compiler should be able to get that switch down to a
> few ops and a table lookup.
> 
> BTW how does DMD implement switches for integers? some sort of perfect
> hash generator and a table lookup?

I think Kris was pointing out that the runtime needs to parse the format
string, but with chained calls there is a possibility to statically
dispatch in many cases - of course e.g. OOP polymorphism still needs normal
runtime lookups.



More information about the Digitalmars-d mailing list