Thread overview
dmd compiler hang time
Dec 25, 2005
clayasaurus
Dec 27, 2005
Thomas Kuehne
Dec 30, 2005
Dave
Jan 01, 2006
Thomas Kuehne
Dec 27, 2005
clayasaurus
Dec 27, 2005
Lars Ivar Igesund
December 25, 2005
I'm not sure if this is a bug, but compiling it will cause DMD to hang for a considerable amount of time.

Set MAX_PARTICLES to 2000 for a short hang, and anything over for a (exponentially?) longer hang. In the example I set it to 10000, which took ~5 minutes to compile on my machine.

DMD .141 linux



December 27, 2005
clayasaurus schrieb am 2005-12-25:
>
> I'm not sure if this is a bug, but compiling it will cause DMD to hang for a considerable amount of time.
>
> Set MAX_PARTICLES to 2000 for a short hang, and anything over for a (exponentially?) longer hang. In the example I set it to 10000, which took ~5 minutes to compile on my machine.
>
> DMD .141 linux

> const int MAX_PARTICLES = 10000;
>
> /* Create our particle structure */
> struct particle
> {
>     int   active; /* Active (Yes/No) */
>     float life;   /* Particle Life   */
>     float fade;   /* Fade Speed      */
>
>     float r;      /* Red Value       */
>     float g;      /* Green Value     */
>     float b;      /* Blue Value      */
>
>     float x;      /* X Position      */
>     float y;      /* Y Position      */
>
>     float xi;     /* X Direction     */
>     float yi;     /* Y Direction     */
>
>     float xg;     /* X Gravity       */
>     float yg;     /* Y Gravity       */
> }
>
> /* Our beloved array of particles */
> particle particles[MAX_PARTICLES];

Added to DStress as http://dstress.kuehne.cn/run/a/array_initialization_21_A.d http://dstress.kuehne.cn/run/a/array_initialization_21_B.d http://dstress.kuehne.cn/run/a/array_initialization_21_C.d http://dstress.kuehne.cn/run/a/array_initialization_21_D.d http://dstress.kuehne.cn/run/a/array_initialization_21_E.d http://dstress.kuehne.cn/run/a/array_initialization_21_F.d

Thomas


December 27, 2005
Just realized the problem is fixed with

particle particles[MAX_PARTICLES] = void;

But I am still amazed at the time it takes to initialize large arrays, I didn't know it was done at compile time.

clayasaurus wrote:
> I'm not sure if this is a bug, but compiling it will cause DMD to hang for a considerable amount of time.
> 
> Set MAX_PARTICLES to 2000 for a short hang, and anything over for a (exponentially?) longer hang. In the example I set it to 10000, which took ~5 minutes to compile on my machine.
> 
> DMD .141 linux
> 
> 
> ------------------------------------------------------------------------
> 
> const int MAX_PARTICLES = 10000;
> 
> /* Create our particle structure */
> struct particle
> {
>     int   active; /* Active (Yes/No) */
>     float life;   /* Particle Life   */
>     float fade;   /* Fade Speed      */
> 
>     float r;      /* Red Value       */
>     float g;      /* Green Value     */
>     float b;      /* Blue Value      */
> 
>     float x;      /* X Position      */
>     float y;      /* Y Position      */
> 
>     float xi;     /* X Direction     */
>     float yi;     /* Y Direction     */
> 
>     float xg;     /* X Gravity       */
>     float yg;     /* Y Gravity       */
> } 
> 
> /* Our beloved array of particles */
> particle particles[MAX_PARTICLES];
December 27, 2005
You might be able to check this with the readelf tool in binutils.

An object file has two types of reserved sections for a programs data.

The section named .bss holds uninitialized data which is initialized with zeros at program start time. The sections .data and .data1 holds initialized data already stored in the object file. The data might also be stored in other sections, but in those cases it might be difficult to find it without knowing the contents of quite a few other sections.

I suppose this is a feature to speed up program startup on the expense of compile time.

IMO this is no bug, although the docs probably should be clearer on the implications of how you initialize your arrays.

Lars Ivar

clayasaurus wrote:

> Just realized the problem is fixed with
> 
> particle particles[MAX_PARTICLES] = void;
> 
> But I am still amazed at the time it takes to initialize large arrays, I didn't know it was done at compile time.
> 
> clayasaurus wrote:
>> I'm not sure if this is a bug, but compiling it will cause DMD to hang for a considerable amount of time.
>> 
>> Set MAX_PARTICLES to 2000 for a short hang, and anything over for a (exponentially?) longer hang. In the example I set it to 10000, which took ~5 minutes to compile on my machine.
>> 
>> DMD .141 linux
>> 
>> 
>> ------------------------------------------------------------------------
>> 
>> const int MAX_PARTICLES = 10000;
>> 
>> /* Create our particle structure */
>> struct particle
>> {
>>     int   active; /* Active (Yes/No) */
>>     float life;   /* Particle Life   */
>>     float fade;   /* Fade Speed      */
>> 
>>     float r;      /* Red Value       */
>>     float g;      /* Green Value     */
>>     float b;      /* Blue Value      */
>> 
>>     float x;      /* X Position      */
>>     float y;      /* Y Position      */
>> 
>>     float xi;     /* X Direction     */
>>     float yi;     /* Y Direction     */
>> 
>>     float xg;     /* X Gravity       */
>>     float yg;     /* Y Gravity       */
>> }
>> 
>> /* Our beloved array of particles */
>> particle particles[MAX_PARTICLES];

December 30, 2005
Thomas - thanks once again for your efforts w.r.t. DStress.

I have to ask though, why does the DStress "home page" show so poorly for DMD as opposed to GDC? Is it because of the -fPIC -O failures?

Thanks,

- Dave

In article <4ut483-pn6.ln1@birke.kuehne.cn>, Thomas Kuehne says...
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>clayasaurus schrieb am 2005-12-25:
>>
>> I'm not sure if this is a bug, but compiling it will cause DMD to hang for a considerable amount of time.
>>
>> Set MAX_PARTICLES to 2000 for a short hang, and anything over for a (exponentially?) longer hang. In the example I set it to 10000, which took ~5 minutes to compile on my machine.
>>
>> DMD .141 linux
>
>> const int MAX_PARTICLES = 10000;
>>
>> /* Create our particle structure */
>> struct particle
>> {
>>     int   active; /* Active (Yes/No) */
>>     float life;   /* Particle Life   */
>>     float fade;   /* Fade Speed      */
>>
>>     float r;      /* Red Value       */
>>     float g;      /* Green Value     */
>>     float b;      /* Blue Value      */
>>
>>     float x;      /* X Position      */
>>     float y;      /* Y Position      */
>>
>>     float xi;     /* X Direction     */
>>     float yi;     /* Y Direction     */
>>
>>     float xg;     /* X Gravity       */
>>     float yg;     /* Y Gravity       */
>> }
>>
>> /* Our beloved array of particles */
>> particle particles[MAX_PARTICLES];
>
>Added to DStress as http://dstress.kuehne.cn/run/a/array_initialization_21_A.d http://dstress.kuehne.cn/run/a/array_initialization_21_B.d http://dstress.kuehne.cn/run/a/array_initialization_21_C.d http://dstress.kuehne.cn/run/a/array_initialization_21_D.d http://dstress.kuehne.cn/run/a/array_initialization_21_E.d http://dstress.kuehne.cn/run/a/array_initialization_21_F.d
>
>Thomas
>
>
>-----BEGIN PGP SIGNATURE-----
>
>iD8DBQFDr8ik3w+/yD4P9tIRAhrrAJ9/r3ZxceCkJRtPm8GDeR+3Mt/BxACbB4U+
>8+UoI/LmPdhHgjELz69sw9k=
>=nuOh
>-----END PGP SIGNATURE-----


January 01, 2006
Dave schrieb am 2005-12-30:
> I have to ask though, why does the DStress "home page" show so poorly for DMD as opposed to GDC? Is it because of the -fPIC -O failures?

Yes, the summary lists the worst result per compiler and test case.

Thomas