On Friday, 20 September 2013 at 23:03:48 UTC, H. S. Teoh wrote:
I'll continue refining the analysis while Walter works on more
lazy
instantiations for imports. I'm expecting to see a lot of
improvements
in this area. :)
I have been doing similar analysis for some time too, only mostly
manually (was curious what symbols actually get included for
trivial programs), with pretty much the same conclusion.
Right now I am pretty much convinced that we need some sort of
whole program optimization and tweak language spec to allow it
safely (i.e. force dynamically loaded symbols to be marked with
export).
Lot of code bloat comes from stuff which is unnecessary in the
big picture but compiler has to means to decide it during
compilation. There is no real reason why
`[1, 2, 3].map!(a => a*2)().reduce!((a, b) => a + b)(0)`
can't be reduce to single loop and inlined, leaving no traces of
actual std.algorithm usage.
Other than compiler can't possibly be sure that you won't try to
link to those generate instances somewhere (or pass it to shared
library). That feels like a language design issue to address.