Method Call Overhead Stats for GDC (function vs virtual vs final)

Jason House jason.james.house at gmail.com
Fri Jul 25 09:27:40 PDT 2008


A few days ago, I added "final" to many of my speed critical function calls and got a 20% speed gain to my simulation-based application.  Maybe it was from extra inlining?

eris Wrote:

> Hello D programmers.
> 
> I'm implementing a simulation in D that will likely make sustained and intense use of method calls.  Naturally I wanted to determine the overhead for various types of call invocations.  Throwing all advice against "premature optimization" aside I wrote a short program to test this.
> 
> One of the primary questions I wanted answered was "Would marking methods with the 'final' attribute help the compiler optimize those calls into something very close to a simple function call?"



More information about the Digitalmars-d mailing list