Performance dmd vs ldc2

John Colvin john.loughran.colvin at
Wed Jul 31 04:13:12 PDT 2013

On Wednesday, 31 July 2013 at 08:44:30 UTC, Chris wrote:
> On Tuesday, 30 July 2013 at 16:43:52 UTC, John Colvin wrote:
>> Are you sure that ldc hasn't actually just optimised away the 
>> whole of parse()?
>> Check to asm to be sure.
> I've checked the asm output, as you suggested. Turns out that 
> the DMD version has 94,220 lines and calls parse() for the 
> first time on line 3278 like so:
> call	  _D10xmlparser25parseFZv at PC32
> The LDC version has 14,347 line and calls parse() for the first 
> time on line 155 like so:
> call	  _D10xmlparser25parseFZv
> However, I'm no expert on asm so it's anyone's guess but mine. 
> But I'm willing to learn.

I would suggest doing the following:

dmd -c file.d -offiledmd.o
ldc2 -c file.d -of=fileldc.o
objdump -M intel -dr filedmd.o > filedmd.s
objdump -M intel -dr fileldc.o > fileldc.s

Then you'll have all the info you need and hopefully a lot less 
of what you don't need

What you're looking for is the definition of parse, like
0000000000000050 <_D10xmlparser25parseFZv>:

or similar and then seeing if there's anything much in the 
function body below.

More information about the digitalmars-d-ldc mailing list