Summary: Long compilation time of a destroy() on a large
                    fixed-sized matrix
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2012-10-15 19:07:14 PDT ---
Problem found by Damian on D.learn:

This program takes a lot of time to compile:

void main() {
    int[500][500] arr;

It generates an assembly like:

        mov    EAX,offset FLAT:_D13TypeInfo_G50i6__initZ
        push    EAX
        call    near ptr __d_arrayliteralTX
        mov    [EAX],EBX
        mov    4[EAX],EBX
        mov    8[EAX],EBX
        mov    0Ch[EAX],EBX
        mov    010h[EAX],EBX
        mov    014h[EAX],EBX
        mov    018h[EAX],EBX
        mov    01Ch[EAX],EBX
        mov    020h[EAX],EBX
        mov    024h[EAX],EBX
        mov    028h[EAX],EBX
        mov    02Ch[EAX],EBX
        mov    030h[EAX],EBX
        mov    034h[EAX],EBX
        mov    038h[EAX],EBX
        mov    03Ch[EAX],EBX
        mov    040h[EAX],EBX
        mov    044h[EAX],EBX
        mov    048h[EAX],EBX
        mov    04Ch[EAX],EBX
        mov    050h[EAX],EBX
        mov    054h[EAX],EBX
        mov    058h[EAX],EBX
        mov    05Ch[EAX],EBX
        mov    060h[EAX],EBX
        mov    064h[EAX],EBX
        mov    068h[EAX],EBX
        mov    06Ch[EAX],EBX
        mov    070h[EAX],EBX
        mov    074h[EAX],EBX
        mov    078h[EAX],EBX
        mov    07Ch[EAX],EBX
        mov    080h[EAX],EBX
        mov    084h[EAX],EBX
        mov    088h[EAX],EBX
        mov    08Ch[EAX],EBX
        mov    090h[EAX],EBX
        mov    094h[EAX],EBX
        mov    098h[EAX],EBX
        mov    09Ch[EAX],EBX
        mov    0A0h[EAX],EBX
        mov    0A4h[EAX],EBX
        mov    0A8h[EAX],EBX
        mov    0ACh[EAX],EBX
        mov    0B0h[EAX],EBX
        mov    0B4h[EAX],EBX
        mov    0B8h[EAX],EBX

I don't think that's good for a large 2D fixed-sized matrix.

Workaround: use something like:

foreach (ref row; arr)
    row[] = typeof(row[0]).init;

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to