[Issue 8487] Semantic analysis of templates is insanely slow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 31 20:45:18 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8487



--- Comment #3 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-07-31 20:45:16 PDT ---
> Well, the performance can probably be improved, but I'd advise rewriting that
snippet to use CTFE instead.

I'm trying to figure out how to do that, and I'll probably manage it, but that
means using an array instead of TypeTuple, and arrays don't have the benefit of
forcing CTFE, making it much harder (and the need to have the literals treated
as literals at the right time and not before also complicates things). It's
quite clean with TypeTuples (aside from the fact that I'm forced to split it
across multiple type tuples so that the template instantiations don't choke at
100, thinking that they're recursing infinitely), and I'd much prefer to use
them, but with this poor performance, it's not really reasonable.

> Templates aren't meant for computation.

I don't buy that. D's templates are specifically designed in a way to make that
sort of thing possible, and in this particular case, using templates is
definitely easier than CTFE.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list