Inherent code performance advantages of D over C?

Marco Leise Marco.Leise at gmx.de
Sat Dec 7 01:30:52 PST 2013


Am Fri, 06 Dec 2013 15:48:27 -0800
schrieb Walter Bright <newshound2 at digitalmars.com>:

> On 12/6/2013 3:40 PM, bearophile wrote:
> > Recently I have seen this through Reddit (with a comment by Anon):
> >
> > http://eli.thegreenplace.net/2013/12/05/the-cost-of-dynamic-virtual-calls-vs-static-crtp-dispatch-in-c/
> >
> > The JavaVM is often able to de-virtualize virtual calls.
> 
> I know. It is an advantage that JITing has. It's also an advantage if you can do 
> whole-program analysis, which can easily be done in Java.

How is that easier in Java? When whole-program analysis finds
that there is no class extending C, it could devirtualize all
methods of C, but(!) you can load and unload new derived
classes at runtime, too.

Also the JVM doesn't load all classes at program startup,
because it would create too much of a delay. This goes so
far that there is even a special class for splash screens with
minimal dependencies, to avoid loading most of the runtime and
GUI library first.

I think whole-program analysis in such an environment is
outright impossible.

-- 
Marco



More information about the Digitalmars-d mailing list