Inherent code performance advantages of D over C?
bearophile
bearophileHUGS at lycos.com
Fri Dec 6 15:40:35 PST 2013
Walter Bright:
> It does for classes/methods marked 'final' and also in cases
> where it can statically tell that a class instance is the most
> derived type.
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.
Regarding Java performance matters, from my experience another
significant source of optimization in the JavaVM that is often
overlooked is that the JavaVM is able to partially unroll even
loops with a statically-unknown number of cycles. Currently I
think GCC/DMD/LDC2 are not able or willing to do this. I think
LLVM was trying to work on this problem a little.
Bye,
bearophile
More information about the Digitalmars-d
mailing list