I dun a DIP, possibly the best DIP ever
Manu
turkeyman at gmail.com
Wed Apr 22 12:04:30 UTC 2020
We have a compile time problem, and this is basically the cure.
Intuitively, people imagine CTFE is expensive (and it kinda is), but
really, the reason our compile times are bad is template instantiation.
This DIP single-handedly fixes compile-time issues in programs I've written
by reducing template instantiations by near-100%, in particular, the
expensive ones; recursive instantiations, usually implementing some form of
static map.
https://github.com/dlang/DIPs/pull/188
This is an RFC on a draft, but I'd like to submit it with a reference
implementation soon.
Stefan Koch has helped me with a reference implementation, which has so far
gone surprisingly smoothly, and has shown 50x improvement in compile times
in some artificial tests.
I expect much greater improvements in situations where recursive template
expansion reaches a practical threshold due to quadratic resource
consumption used by recursive expansions (junk template instantiations, and
explosive symbol name lengths).
This should also drastically reduce compiler memory consumption in
meta-programming heavy applications.
In addition to that, it's simple, terse, and reduces program logic
indirection via 'utility' template definitions, which I find improves
readability substantially.
We should have done this a long time ago.
- Manu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20200422/7f03eb86/attachment.htm>
More information about the Digitalmars-d
mailing list