Re: Optimization for OOP

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Mon, 5 May 2008 18:37:26 +0200

          From comp.compilers

Related articles
Optimization for OOP sgkelly4@gmail.com (2008-05-03)
Re: Optimization for OOP torbenm@app-1.diku.dk (2008-05-05)
Re: Optimization for OOP mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-05-05)
Re: Optimization for OOP dot@dotat.at (Tony Finch) (2008-05-05)
Re: Optimization for OOP lucretia9@lycos.co.uk (lucretia9@lycos.co.uk) (2008-05-05)
Re: Optimization for OOP mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-05-06)
Re: Optimization for OOP sgkelly4@gmail.com (2008-05-06)
| List of all articles for this month |

From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups: comp.compilers
Date: Mon, 5 May 2008 18:37:26 +0200
Organization: cbb software GmbH
References: 08-05-008 08-05-010
Keywords: OOP, optimize
Posted-Date: 05 May 2008 17:12:42 EDT

On Mon, 05 May 2008 09:45:24 +0200, Torben Fgidius Mogensen wrote:


> The most important optimisation is to get rid of dynamic method calls.
>
> This can, however, be quite tricky as you can't tell if a method can
> be overridden without knowing the whole program, so it plays havoc
> with separate compilation. A compromise is to allow methods to be
> declared "final", which ensures it is never overridden.


I think a consistent types system would be a better way. In Ada it is
always known if a call is dispatching or not. That is because of
proper typing. When an object is of a specific type, its methods never
dispatch, for that obvious reason, that the type is known to be
specific.


For the same reason in Ada there is no implicit re-dispatch from the
method bodies. A method always deals with a specific type, it has
dispatched before. Therefore any further calls from there to other
methods never dispatch again. The compiler knows their targets
statically, it can inline them etc.


--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.