Slow performance compared to C++, ideas?

Timon Gehr timon.gehr at gmx.ch
Thu Jun 6 14:28:23 PDT 2013


On 06/06/2013 07:55 PM, Steven Schveighoffer wrote:
> On Thu, 06 Jun 2013 13:50:11 -0400, deadalnix <deadalnix at gmail.com> wrote:
>
>> 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.
>
> How do you finalize a method with the possibility that a dynamic library
> will come along and extend that type?  Not a rhetorical question, I
> really want to know if there is a way.  Java and C# clearly have more
> flexibility there, since they are run on a VM.
>
> -Steve

The more advanced JVM's assume a closed world for JIT optimization and 
then perform deoptimization whenever a dynamic library is loaded that 
invalidates some assumptions made for optimization.


More information about the Digitalmars-d mailing list