On Thursday, 19 May 2016 at 12:38:09 UTC, Steven Schveighoffer
wrote:
On 5/17/16 6:04 PM, ZombineDev wrote:
On Tuesday, 17 May 2016 at 21:58:06 UTC, Andrei Alexandrescu
wrote:
On 05/17/2016 05:44 PM, Georgi D wrote:
Hi,
While working on a D project which heavily uses the lazy
algorithms for
ranges I noticed a sudden huge increase in the compilation
time and the
produced binary size.
[snip]
Thanks. That's definitely deserving of a bug report. -- Andrei
I'm guessing that is highly related to this one:
https://issues.dlang.org/show_bug.cgi?id=15831
Yep. chain uses voldemort type, map does not.
Georgi: try copying chain implementation into your local file,
but instead of having a static internal struct, move it to a
module-level struct (you probably have to repeat the template
parameters, but not the constraints). See if it produces a
similar slimming effect.
-Steve
Yes,
Making a local copy of chain and moving the structure outside of
the method solved the problem and reduced the code size.
The stripped size even reduced from the version that did not
experience the huge increase. Stripped: 7.4Mb -> 5.5MB
Should we actually change the implementation in phobos to be like
this?
In the company I work in we are very sensitive to the code size
so anything that can be made for this in phobos will help with
adoption.
I am still curious though why the code size increased so
dramatically with such a small change. Both versions return a
result from chain and actually the one that does not experience
the increase is more complex (includes the one that does).
In my actual code I have multiple calls to chain on top of the
result of this and the code size does not increase dramatically.
I am also concerned by the fact that ldc on mac just could not
compile the source which produced the big binary (entering an
infinite loop).
Thanks