On Thursday, 6 June 2013 at 15:06:38 UTC, Kapps wrote:
On Thursday, 6 June 2013 at 01:08:36 UTC, deadalnix wrote:
This is why I wrote that this may have been true in the past.
Nevertheless, it is completely false today.
C# often does not inline virtual methods, and even if it can
inline them there's still an overhead. This (2008) article goes
into depth about how it handles it:
www.codeproject.com/Articles/25801/JIT-Optimizations -
Essentially uses frequency analysis to determine if the virtual
method call is still going to call the same method as it would
previously. Regardless, we can not perform such optimizations,
so whether or not it applies to C#, it does apply to D.
Quite frankly, I don't care what C# does. Java does it at link
time, and we can do it at link time the same way, that is all
that matter for this discussion.
Unless C# don't do it because it is impossible, this is only a C#
implementation detail.