Efficient dynamic dispatch without virtual function tables: the SmallEiffel compiler

Kris foo at bar.com
Fri Mar 7 09:58:43 PST 2008


"Craig Black" <cblack at ara.com> wrote in message 
news:fqrt7n$1aj2$1 at digitalmars.com...
>I found this article on the internet.  It concurs with my theories about 
>the overhead of virtual function calls.  Here's the abstract:
>
> SmallEiffel is an Eiffel compiler which uses a fast simple type inference 
> mechanism to remove most late binding calls, replacing them by static 
> bindings. Starting from the system's entry point, it compiles only 
> statically living code, which saves compiling and then removing dead code. 
> As the whole system is analyzed at compile time, multiple inheritance and 
> genericity do not cause any overhead.SmallEiffel features a coding scheme 
> which eliminates the need for virtual function tables. Dynamic dispatch is 
> implemented without any array access but uses a simple static binary 
> branch code. We show that this implementation makes it possible to use 
> modern hardware very efficiently. It also allows us to inline more calls 
> even when dynamic dispatch is required. Some more dispatch sites are 
> removed after the type inference algorithm has been performed, if the 
> different branches of a dispatch site lead to the same code.The advantage 
> of this approach is that it greatly speeds up execution time and 
> considerably decreases the amount of generated code.
> -Craig


We've seen the results of this quite clearly in D, where xml DOM parsing is 
actually faster than SAX parsing (which should cause some folks to do a 
double-take about now). The reason is that the DOM parser avoids vcalls, 
whereas the SAX parser currently does not. That overhead is sufficient to 
offset all the extra work performed by the DOM parser. Yeah, this is a 
perhaps special-case, but an interesting one all the same? 





More information about the Digitalmars-d mailing list