Build time/costs

Manu turkeyman at gmail.com
Tue Dec 11 06:15:45 UTC 2018


So, I know people have studied this, but I can't find any evidence of
concise collated data.
I don't know how to implement CT range logic efficiently.
There are 3 competing strategues:
- recursive template expansion (including staticMap)
- static foreach, which may require a fail-test suffix if no iteration
of the loop assigned the template
- CTFE foreach

Which is preferable, and for what counts of elements?
I think conventional wisdom is that CTFE is always superior? Is that
true? *always*?
Is there any CTFE overhead on small datasets (ie, 0-2 elements).
Is there overhead in the case where you might need to coerce a tuple
into a runtime array for looping on by surrounding it in `[ tup ]`?

What about static foreach? Is it superior to CTFE foreach in the
limited places where it's applicable, but where either could be
chosen?

We need reliable best-practises.

On a tangent, I think D would really benefit from C++11's `...`
expression; which applies a static-map in-language without any
recursive template expansions or other workarounds, and with a much
improved readability.
That expression could replace basically every application of static
operation on lists extremely efficiently... has it been rejected
already? Why?


More information about the Digitalmars-d mailing list