Am Fri, 09 Sep 2016 07:56:04 +0000 schrieb Stefan Koch <uplink.co...@googlemail.com>:
> Hi Guys, > > I keep this short. > There seems to be much more headroom then I had thought. > > The Idea is pretty simple. > > Consider : > int fn(int padLength)(int a, int b, int c) > { > /** > very long function body 1000+ lines > */ > return result * padLength; > } > > This will produce roughly the same code for every instaniation > expect for one imul at the end. > > […] Don't worry about this special case too much. At least GCC can turn padLength from a runtime argument into a compile-time argument itself, so the need for templates to do a poor man's const-folding is reduced. So in this case the advise is not to use a template. You said that there is a lot of code-gen and string comparisons going on. Is code-gen already invoked on-demand? I assume with "dmd -o-" code-gen is completely disabled, which is great for ddoc, .di and dependency graph generation. -- Marco