Incremental compilation with DMD

Tom S h3r3tic at remove.mat.uni.torun.pl
Thu Sep 17 18:36:31 PDT 2009


Walter Bright wrote:
> Tom S wrote:
>> Personally I'm of the opinion that functions should be explicitly 
>> marked for CTFE, and this is just another reason for such. I'm using a 
>> patched DMD with added pragma(ctfe) which instructs the compiler not 
>> to run any codegen or generate debug info functions/aggregates marked 
>> as such. This trick alone can slim an executable down by a good 
>> megabyte, which sometimes is a life-saver with OPTLINK.
> 
> If you are compiling files with -lib, and nobody calls those CTFE 
> functions at runtime, then they should never be linked in. (Virtual 
> functions are always linked in, as they have a reference to them even if 
> they are never called.)
> 
> Executables built this way shouldn't have dead functions in them.

It could be debug info, because with -g something definitely is linked 
in whether it's -lib or not (except with -lib there's way more of it). 
With ctfe-mixin-based metaprogramming, you also end up with string 
literals that don't seem to get optimized away by the linker.


-- 
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode



More information about the Digitalmars-d mailing list