Optimizing with large numbers of templates

Christopher Wright dhasenan at gmail.com
Mon Aug 25 19:29:02 PDT 2008


Hey all,

I've got a sample that did take five minutes to compile and produced a 
4MB executable, and now it's down to 2MB and just over a minute, but 
most of that (1.6MB) is just template code, and I'd like to reduce that 
further.

What are the typical suggestions for optimizing code that's heavy on 
templates? My major problem is build time, though executable size is 
also a concern. Runtime isn't important (the current code can run 10,000 
times in a hundredth of a second on that hideously large example, and it 
shouldn't need to run very much at all).

For reference, the code is dconstructor, and the example is speed.d from 
the examples folder:
svn co http://svn.dsource.org/projects/dmocks/dconstructor/trunk


More information about the Digitalmars-d-learn mailing list