CTFE Status

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 8 19:06:49 PST 2016


On Friday, 9 December 2016 at 02:10:58 UTC, Andrei Alexandrescu 
wrote:
> 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

That will not work currently.
Since function and methods calls are still "in the works".
They will require another restructuring as well.
Therefore artificial tests are the best I can do to gunge 
performance.



More information about the Digitalmars-d mailing list