[Mono-list] Overridden method calling base method (and doing nothing else)

Miguel de Icaza miguel at novell.com
Sat Dec 29 22:11:52 EST 2007

> I have not experimentally verified this, but it seems like unnecessarily
> overriding a method can potentially increase runtime, because the time
> needed to dispatch a method increases with each overriding of a virtual
> method. This would be in addition to the overhead of calling the base
> method. The latter expense might not be an issue if the runtime cleverly
> inlines the call to the base method, but overridden virtual methods are
> known to make such optimizations difficult.

The only expense happens if you call the base class, otherwise you can
override as much as you want, and you will never have a penalty.

The only penalty (if you can call it that) is calling "base.Method" when
you depend on it.

Now, if you have some tight code, lets say doing 3D rendering, or fast
fourier transforms you will probably avoid virtual methods altogether,
but in practice, I do not think this is even something that shows up in


More information about the Mono-list mailing list