On Thursday, 19 September 2013 at 17:55:22 UTC, Iain Buclaw wrote:
But yes, that is the general essence, though I was more leaning on Java's class hierarchy and being virtual by default. This is something that you can't get away from in native code, where as in most Java JIT implementations, they are designed explicitly for lots of virtual calls, such as the ability to inline virtual functions at runtime
which makes virtual calls as cheap as non-virtual.

In native code however, there is no way for the compiler to optimise this at compile-time, and the slowdown grinds as the code base grows (gcc's libjava is 230K LOC for example), and the result is that you
end up paying through the nose without asking - we've already
discussed this plentiful in D's design choice to go virtual by
default.

Our AOT compiler does inline virtual calls of non-final methods that are not overloaded in any subclass known at compile time. Of course, there is a runtime check and a backup virtual call, but the check is cheap and code size increase in negligible.

What we don't do (yet) is profile-guided optimizations, but that is on our to-do list.

--
Dmitry
www.ExcelsiorJET.com

Reply via email to