Why Java (server VM) is faster than D?
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 3 09:54:42 PDT 2015
On 8/3/15 12:50 PM, John Colvin wrote:
> On Monday, 3 August 2015 at 16:47:14 UTC, Adam D. Ruppe wrote:
>> You can try a few potential optimizations in the D version yourself
>> and see if it makes a difference.
>>
>> Devirtualization has a very small impact. Test this by making `test`
>> take `SubFoo` and making `bar` final, or making `bar` a stand-alone
>> function.
>>
>> That's not it.
>
> Making SubFoo a final class and test take SubFoo gives a >10x speedup
> for me.
Let's make sure we're all comparing apples to apples here.
FWIW, I suspect the inlining to be the most significant improvement,
which is impossible for virtual functions in D.
ALSO, make SURE you are compiling in release mode, so you aren't calling
a virtual invariant function before/after every call.
-Steve
More information about the Digitalmars-d
mailing list