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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 16 22:00:55 PDT 2015


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

--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Vladimir Panteleev from comment #3)
> This is a regression.
> 
> Introduced in https://github.com/D-Programming-Language/dmd/pull/2605

The root issue is the inefficiency of 'dt' structure in dmd backend.

Reduced test case:

struct S(T, size_t dim)
{
    T[dim] data;
}
version(OK) alias X = S!(  uint, 128*1024);
version(NG) alias X = S!(double, 128*1024);

If the static array element is zero value (e.g. uint.init), it's handled as "N
zero bytes". If the element value is non-zero (e.g. double.init), it's handled
as 131072 repetition of RealExp.

Therefore, following code also hits the performance issue.

struct S(T, size_t dim)
{
    T[dim] data = 1;  // non-zero elemnet
}
alias X = S!(uint, 128*1024);

--


More information about the Digitalmars-d-bugs mailing list