Bug 10441 – Static libraries too big

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2013-06-21T22:12:00Z
Last change time
2013-10-10T15:08:17Z
Assigned to
nobody
Creator
g.sayol

Comments

Comment #0 by g.sayol — 2013-06-21T22:12:44Z
When compiling GtkD <https://github.com/gtkd-developers/GtkD> with dmd 2.063.2, the resulting static libraries size increases a lot. GtkD-2 (HEAD) built with dmd 2.062 (64-bit): libgstreamerd-2.a (3,3M) libgtkd-2.a (35M) libgtkdgda-2.a (1021K) libgtkdgl-2.a (492K) libgtkdsv-2.a (1,3M) GtkD-2 (HEAD) built with dmd 2.063.2 (64-bit): libgstreamerd-2.a (14M) libgtkd-2.a (138M) libgtkdgda-2.a (4,9M) libgtkdgl-2.a (3,0M) libgtkdsv-2.a (5,8M)
Comment #1 by g.sayol — 2013-06-21T23:20:32Z
Same on dcollections <http://www.dsource.org/projects/dcollections> dcollections r117 built with dmd 2.062 (64-bit): libdcollections.a (123K) dcollections r117 built with dmd 2.063.2 (64-bit): libdcollections.a (2,0M)
Comment #2 by mike — 2013-06-22T07:19:54Z
It looks like this is being caused by a change/bug? in phobos/druntime.
Comment #3 by g.sayol — 2013-06-23T00:51:06Z
It seems that the problem comes from the object file generation. i.e. at GtkD project, the file "src/cairo/Types.d" <https://github.com/gtkd-developers/GtkD/blob/master/src/cairo/Types.d> $ dmd -c -O -m64 -Isrc src/cairo/Types.d Built with dmd 2.062 (64-bit): Types.o (4.6K) Built with dmd 2.063.2 (64-bit): Types.o (149K)
Comment #4 by mike — 2013-06-23T05:38:57Z
I was using git bisect with dmd, but couldn't find the commit that introduced the bug. As it turns out i was running the tests with the phobos lib from 2.063. And building gtkD with dmd 2.063 in combination with the phobos libs and sources from 2.062 the size of the GtkD lib is back to ~35M.
Comment #5 by mike — 2013-06-23T07:48:47Z
The first Phobos commit that causes the huge library size is: https://github.com/D-Programming-Language/phobos/commit/337f268cf1e24a25728eea417c4a76a907eec21e Before that change the GtkD lib size is ~35M and after it's ~144M. Only checking out the latest Phobos HEAD and reverting 337f268cf1e24a25728eea417c4a76a907eec21e the GtkD lib is still ~125M so there are other commits that have an similar affect.
Comment #6 by mailnew4ster — 2013-06-23T08:27:03Z
I believe the following suggestion should improve the situation: http://forum.dlang.org/post/[email protected]
Comment #7 by mike — 2013-06-24T13:40:11Z
Comment #8 by hsteoh — 2013-08-28T22:09:03Z
This is just a wild guess, but could it be caused by the use of std.format in the unittests? I know that std.format is quite template-heavy; even a single use of it can trigger the instantiation of quite a large number of templates.
Comment #9 by bugzilla — 2013-09-11T16:45:29Z
Comment #10 by andrej.mitrovich — 2013-09-11T17:27:11Z
It looks like these issues were all caused by my pull request. Well don't I feel like a bastard now. :) I do hope this is fixed in the compiler rather than to have to hack around it in Phobos.
Comment #11 by k.hara.pg — 2013-09-11T19:35:48Z
(In reply to comment #7) > I found the other phobos commit that caused the large lib: > > https://github.com/D-Programming-Language/phobos/commit/4f5079e4f8d38e1d469e4b28303553f36f49e33b > > reverting both: > https://github.com/D-Programming-Language/phobos/commit/337f268cf1e24a25728eea417c4a76a907eec21e > and > https://github.com/D-Programming-Language/phobos/commit/4f5079e4f8d38e1d469e4b28303553f36f49e33b > > leaves me with a Gtkd lib of ~36M, using dmd 2.063.2 These changes have also caused bug 10631. I think these issues would have same root.
Comment #12 by github-bugzilla — 2013-09-12T18:05:55Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/12bb9afb753ad2f2aef65550b960357c63854cbc fix Issue 10441 - Static libraries too big https://github.com/D-Programming-Language/dmd/commit/ba48d3e9e398967dc0b8d374868678613c8cb84a Merge pull request #2550 from WalterBright/fix10441 fix Issue 10441 - Static libraries too big