On Thursday, 3 March 2016 at 02:03:01 UTC, maik klein wrote:
Consider the following codevoid main() { import std.stdio; import std.range: iota, join; import std.algorithm.iteration: map; import std.conv: to; import std.meta: aliasSeqOf, staticMap, AliasSeq;enum types = "AliasSeq!(" ~ iota(0,10000).map!(i => to!string(i)).join(",") ~ ")";alias t = AliasSeq! (mixin(types)); //alias t1 = aliasSeqOf!(iota(0, 10000)); }'t' compiles on my machine in ~3.5 seconds while 't1' needs ~1 minute to compile. It seems that mixins are just way more performant than template instantiations. Any ideas why? What causes the slowdown and what can I improve?
What happens if you add a few extra branches to std.meta.aliasSeqOf, e.g. https://github.com/D-Programming-Language/phobos/commit/5d2cdf103bd697b8ff1a939c204dd2ed0eec0b59
Only a linear improvement but maybe worth a try?
