***** D method override mechanisms borked ******

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Mon Jun 26 06:13:50 PDT 2006


xs0 wrote:
> Just a slight correction :)
> 
>> xs0 told in D.announce that it's possible to extend the
>> functionality of interfaces without any extra overhead at all (but it
>> would require more from the optimization logic of the compiler).
> 
> It's possible to eliminate (time) overhead for calls on the same
> reference beyond the first (like in a loop or whatever). The first call
> of an interface method would still be about twice as expensive* as a
> "regular" virtual call (now it's just a few percent slower).

Right, forgot that. Sorry. I was already thinking about a situation
where all this initialization could be done before the control jumps to
the first line of the main(). But I guess that's not even possible
because the classes can be dynamically allocated.

But I think it should be obvious that this overhead is pretty minimal
even without any optimizations at all. Traditionally a programmer would
inline expensive function calls one way or another. But now it would not
be necessary anymore. Better modularity, better software engineering. I
still think it's a bit ridiculous to worry about an overhead of only a
few opcodes - D is supposed to run on fast >= 32bit architectures, for
god's sake. :)



More information about the Digitalmars-d-bugs mailing list