Efficient dynamic dispatch without virtual function tables: the SmallEiffel compiler
Craig Black
cblack at ara.com
Fri Mar 7 13:08:14 PST 2008
"bearophile" <bearophileHUGS at lycos.com> wrote in message
news:fqs79a$26cq$1 at digitalmars.com...
> Craig Black:
>>Some more dispatch sites are removed after the type inference algorithm
>>has been performed,
>
> ShedSkin has one of the most powerful type inference engines around, but
> it gets rather slow. So the things you say too probably require a cost in
> compile time.
>
>
>> Virtual function calls are a common bottleneck iobject-oriented code.
>
> Do you have any static to support what you say here? I have read an
> article that says that in typical OOP C++ code virtual calls slow down
> code by not too much:
> "The Direct Cost of Virtual Function Calls in C++" (1996, oldish):
> http://www.cs.ucsb.edu/~urs/oocsb/papers/oopsla96.pdf
>
> Bye,
> bearophile
As far as hardware is concerned, the longer the pipelines, the worse the
penalty for virtual functions. And modern Intel CPU's have incredibly long
pipelines. I do a lot of OOP and know from experience how bad this
bottleneck can become. Reducing the number of virtual functions for optimal
performance is a big pain in the ass.
Here's an article that talks about reducing virtual function calls in C++.
It talks specifically about doing this for game AI.
http://aigamedev.com/programming-tips/optimize-virtual-functions
-Craig
More information about the Digitalmars-d
mailing list