January 02, 2018
Finally got around to working on my draft article "Compile-time vs. compile-time" again today. Mainly added another case study for a commonly encountered issue, and cleaned up the outdated stuff on "static" foreach (not the *real* static foreach that we have now).  Now I'm reasonably happy with its current form, and am thinking to add it to the list of articles on the wiki.  But thought I should solicit some feedback here first. So here it is:

	https://wiki.dlang.org/User:Quickfur/Compile-time_vs._compile-time#But_what_of_runtime_performance.3F

object.destroy! :-P


T

-- 
What do you mean the Internet isn't filled with subliminal messages? What about all those buttons marked "submit"??
January 03, 2018
On 01/03/2018 02:51 AM, H. S. Teoh wrote:
> 	https://wiki.dlang.org/User:Quickfur/Compile-time_vs._compile-time#But_what_of_runtime_performance.3F
> 
> object.destroy! :-P

In the CTFE section, you explain that it came from constant folding, but you don't point out how the two are different. After reading the section, a newbie might think that the term "CTFE" is for when constant folding evaluates function calls. But that's not what we mean by "CTFE".

What's missing is that CTFE is forced/guaranteed. It's not an optimization. When we say "CTFE", we mean the cases where compilation fails if the expression cannot be evaluated.

I doesn't help that the `i` variables in the examples are (seemingly) globals, but you also talk about putting them in a "busy inner loop". If I just copy the code as it is, `i` is a global and I get actual CTFE. If I put `i` in a loop, it's a local and it's up to the compiler if it does non-CTFE constant folding.

Also, you mistyped Stefan Koch's name.