www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14571] New: Large static arraus seem to lock up DMD

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

          Issue ID: 14571
           Summary: Large static arraus seem to lock up DMD
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

Large static arrays seem to lock up the compiler for some reason:

struct InputPoint
{
  double[3] position;
  ubyte[4] color;
  uint pad;
}

struct GrowableArray(T, size_t chunkSize)
{
  struct Chunk
  {
    T[chunkSize] data;
  }
}

alias X = GrowableArray!(InputPoint, 1024); // <-- this compiles quickly

//alias X = GrowableArray!(InputPoint, 128*1024); // <-- this is very slow,
appears to hang the compiler


I have to say, I'm kinda worried that Chunk.init is going to be some gigantic
statically allocated block of data, rather than a single instance of T that is
repeated 'chunkSize' times...

I use patterns like this in C quite a bit. Should this should be avoided in D?


DMD-Win64 0.67.1

--
May 10 2015