Summary: dmd generates useless template bloat
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2010-08-29 20:36:13 PDT ---
Merely importing a file that contains template can make dmd generate code. This
not only increases compile times, but it also can be the reason for severe exe
bloat: often the linker will pull in completely unrelated modules just to get
symbols for instantiated templates (the bloat is then caused by unrelated
symbols that have been unnecessarily been pulled in).

$ cat a.d
module a;
import b;

$ cat b.d
module b;

struct Bloat(T)
    void foo() {

class NotBloat
    this(Bloat!(uint) x)

$ dmd -c a.d

$ nm a.o|grep Bloat
00000000 W _D1b12__T5BloatTkZ5Bloat3fooMFZv
00000000 V _D1b12__T5BloatTkZ5Bloat6__initZ
00000000 V _D32TypeInfo_S1b12__T5BloatTkZ5Bloat6__initZ

a.d only imports b.d, yet there's this crap in a.o.

Obviously dmd should not generate code in this case.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to