CTFE Status

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 8 18:10:58 PST 2016


On 12/08/2016 04:24 PM, Stefan Koch wrote:
> Results are obtained running the following code
> uint MakeInitAndSumArray(uint length)
> {
>     uint result;
>     uint[] arr;
>     arr.length = length;
>
>     while(length--)
>     {
>         arr[length] = length;
>     }
>     foreach(e;arr)
>     {
>       result += e;
>     }
>
>     return result;
> }
>
> pragma(msg, MakeInitAndSumArray(ushort.max));
> pragma(msg, MakeInitAndSumArray(ushort.max/2));
> pragma(msg, MakeInitAndSumArray(ushort.max*2));

That's pretty awesome. The new CTFE engine release will soon rival Tesla 
Model 3 in terms of interest raised :o).

In addition to artificial corpora like the above, I suggest comparing 
against real-world code - starting with simpler things such as bitfields 
instantiations.


Andrei


More information about the Digitalmars-d mailing list