Increasing D Compiler Speed by Over 75%

Walter Bright newshound2 at digitalmars.com
Fri Aug 2 01:24:57 PDT 2013


On 8/2/2013 12:57 AM, Rainer Schuetze wrote:
>> http://www.digitalmars.com/download/freecompiler.html
>
> Although my laptop got quite a bit faster overnight (I guess it was throttled
> for some reason yesterday), relative results don't change:
>
> std.algorithm -main -unittest
>
> dmc85?: 12.5 sec
> dmc857: 12.5 sec
> msc: 7 sec
>
> BTW: I usually use VS2008, but now also tried VS2010 - no difference.

The two dmc times shouldn't be the same. I see a definite improvement. 
Disassemble aav.obj, and look at the function aaGetRvalue. It should look like this:

?_aaGetRvalue@@YAPAXPAUAA@@PAX at Z:
                 push    EBX
                 mov     EBX,0Ch[ESP]
                 push    ESI
                 cmp     dword ptr 0Ch[ESP],0
                 je      L184
                 mov     EAX,0Ch[ESP]
                 mov     ECX,4[EAX]
                 cmp     ECX,4
                 jne     L139
                 mov     ESI,EBX
                 and     ESI,3
                 jmp short       L166
L139:           cmp     ECX,01Fh
                 jne     L15E
======== note this section does not have a div instruction in it ==============
                 mov     EAX,EBX
                 mov     EDX,08421085h
                 mov     ECX,EBX
                 mul     EDX
                 mov     EAX,ECX
                 sub     EAX,EDX
                 shr     EAX,1
                 lea     EDX,[EAX][EDX]
                 shr     EDX,4
                 imul    EAX,EDX,01Fh
                 sub     ECX,EAX
                 mov     ESI,ECX
==========================================================================
                 jmp short       L166
L15E:           mov     EAX,EBX
                 xor     EDX,EDX
                 div     ECX
                 mov     ESI,EDX
L166:           mov     ECX,0Ch[ESP]
                 mov     ECX,[ECX]
                 mov     EDX,[ESI*4][ECX]
                 test    EDX,EDX
                 je      L184
L173:           cmp     4[EDX],EBX
                 jne     L17E
                 mov     EAX,8[EDX]
                 pop     ESI
                 pop     EBX
                 ret
L17E:           mov     EDX,[EDX]
                 test    EDX,EDX
                 jne     L173
L184:           pop     ESI
                 xor     EAX,EAX
                 pop     EBX
                 ret


More information about the Digitalmars-d-announce mailing list