Performance dmd vs ldc2

John Colvin john.loughran.colvin at gmail.com
Wed Jul 31 05:29:31 PDT 2013


On Wednesday, 31 July 2013 at 11:33:01 UTC, Chris wrote:
> On Wednesday, 31 July 2013 at 11:13:13 UTC, John Colvin wrote:
>> 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.
>
> Thanks. I've just tried it. In dmd it's there as:
>
> 00000000 <_D10xmlparser25parseFZv>:
> [...]
>
> In ldc too, looks only a bit different. There are:
>
> 000002b0 <_D10xmlparser25parseFZv>:
> [...]
> 00000b60 
> <_D10xmlparser25parseFZv9__lambda1MFC3std3xml13ElementParserZv>:
> [...]

Could you post the full asm for those functions?


More information about the digitalmars-d-ldc mailing list