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

Walter Bright <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |WONTFIX

--- Comment #1 from Walter Bright <[email protected]> ---
Issues:

1. `import std` imports all of Phobos. This is quite impractical, and import by
package should never have been added. It will always make compiling desperately
slow and will consume vast quantities of memory.

Recommendation: just import modules that are needed

2. The declaration of `data` has an initialization that must happen at compile
time. The CTFE to do it does not store expressions efficiently - the array is
stored as (256 * 131,070) Expression AST nodes. This is going to consume a lot
of memory, and will also be extremely slow. Then, it will have to generate (256
* 131,070) static initializers.

Recommendation: Replace with a pointer initialized at runtime:

    Array!A(255)* pdata;
    static this() { pdata = new Array!(255); }

which will push that all off to runtime, where it is efficiently handled.

This should resolve the slow compiles, vast compile time memory consumption,
and large executable file size problems. I don't see any reasonable way to fix
this in the language.

--

Reply via email to