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.

Reply via email to