DMD is faster than LDC and GDC

cym13 via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 13 19:46:36 PST 2015


On Friday, 13 November 2015 at 19:59:51 UTC, Ali Çehreli wrote:
> On 11/12/2015 11:50 AM, Ali Çehreli wrote:
>> I would love to be convinced. :) Can someone come up with a 
>> reduced
>> example please?
>>
>> On 11/12/2015 03:59 AM, Daniel Kozak wrote:
>>
>>  >      for (i=0; i < 1000000; ++i) {
>>  >          fmttable(table);
>>  >      }
>>
>> I think what we are seeing here is more due to the unused 
>> side-effect in
>> the loop, where compiling with -w fails compilation:
>>
>> Warning: calling deneme.fmttable without side effects discards 
>> return
>> value of type string, prepend a cast(void) if intentional
>>
>> Ali
>>
>
> Can someone please tell me if I am mistaken not.
>
> Once again, I don't think this example is fast because the 
> compiler reuses the return value of fmttable() in the loop. 
> Rather, it simply removes the whole expression because its only 
> side-effect is not used in the program.
>
> Perhaps that's what everybody else is saying anyway. :)
>
> (Why don't I look at the assembly myself? Going to a meeting... 
> :p)
>
> Ali

I confirm it, here is the loop part:

     0x004375c2    31db           xor ebx, ebx
┌─> 0x004375c4    ffc3           inc ebx
│   0x004375c6    81fb40420f00   cmp ebx, 0xf4240
└─< 0x004375cc    72f6           jb 0x4375c4
     0x004375ce    8bfb           mov edi, ebx
     0x004375d0    e8230d0000     call 
sym._D3std5stdio14__T7writelnTiZ7writelnFNfiZv

(DMD 2.069 -O -release -inline -boundscheck=off, code from the 
first post)



More information about the Digitalmars-d mailing list