What is the size of a module?

Bill Baxter dnewsgroup at billbaxter.com
Sun May 18 20:18:24 PDT 2008


Frank Benoit wrote:
> I want to get an understanding what can make DWT executables smaller and 
> if the modules count is really relevant for it.
> 
> So the question... A given amount of classes/interfaces etc exist. Now a 
> design decision should be made how this code shall be structured into 
> modules and packages.
> 
> What exactly are the costs for moving code into a new module?
> What does affect the resulting binary size?
>  - length of typenames
>  - count of import that the new module has
>  - count of modules that import the new module
>  - static this entry in the module
>  - ?

I would say trying to use the new -lib flag in DMD 1.030 is probably the 
first step now.  Walter said it made smaller exes and improved linking 
times in his tests:

"""
This accelerates library builds by a whopping factor of 3!
...
The library build option has another major coolness feature - [...] one 
source file can compile to multiple object files. This cuts down on 
executable bloat from pulling in object files with irrelevant stuff in 
them.
"""

But maybe bug 2067 prevents you from going forward with such tests right 
now?  Also I'm not sure how much support will be needed from build 
tools.  Sounds like "dsss build -lib" on dwt should do it, since dsss 
just passes through any unknown flags to dmd eventually.  But maybe 
something more is needed.

I guess you'll definitely need to have oneatatime=no in the dsss/rebuild 
configs for that to work.  But I believe that is your standard practice 
anyway.

--bb



More information about the Digitalmars-d mailing list