digitalmars.D - What is the size of a module?
- Frank Benoit (12/12) May 18 2008 I want to get an understanding what can make DWT executables smaller and...
- Bill Baxter (21/35) May 18 2008 I would say trying to use the new -lib flag in DMD 1.030 is probably the...
- Neal Alexander (4/19) May 18 2008 An empty module is like 500 bytes IIRC.
- Tomas Lindquist Olsen (2/22) May 26 2008 As well as their typeinfo.
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 - ?
May 18 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
May 18 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 - ?An empty module is like 500 bytes IIRC. When porting large C headers to D, the biggest factor is the generation of default initializers for the structs i think.
May 18 2008
Neal Alexander wrote:Frank Benoit wrote:As well as their typeinfo.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 - ?An empty module is like 500 bytes IIRC. When porting large C headers to D, the biggest factor is the generation of default initializers for the structs i think.
May 26 2008