[Issue 14571] [REG2.064] Large static arrays seem to lock up DMD

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 22 02:20:33 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14571

--- Comment #7 from Vladimir Panteleev <thecybershadow at gmail.com> ---
(In reply to Walter Bright from comment #6)
> I'll fix this, but you should know that this necessarily creates large
> sections in the executable file of repeated data. For such large arrays, it
> is better to allocate and initialize them on program startup.
> 
> The way globals work on modern CPUs is you are not saving any execution time
> by using static data. Large static arrays is an artifact of FORTRAN.

There are no global variables in the problematic programs given here.

The problem is entirely with .init.

Additionally, dynamic arrays cannot always be used as a drop-in replacement for
static arrays. They add one level of indirection and cannot easily be aligned
together with other types (as with static arrays in a struct).

(In reply to ag0aep6g from comment #1)
> struct InputPoint
> {
>     double position;
> }

The problem should be avoided if you change the declaration to "double position
= 0;"

--


More information about the Digitalmars-d-bugs mailing list