On 03-Aug-2015 19:54, Steven Schveighoffer wrote:
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.

Should be trivial in this particular case. You just keep the original virtual call where it cannot be deduced.


ALSO, make SURE you are compiling in release mode, so you aren't calling
a virtual invariant function before/after every call.

This one is critical. Actually why do we have an extra call for trivial null-check on any object that doesn't even have invariant?


--
Dmitry Olshansky

Reply via email to