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

Reply via email to