CTFE Status
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Wed Nov 16 01:45:24 PST 2016
Here is a small demostration of the performance increase :
[root at localhost dmd]# time src/dmd -c testSettingArrayLength.d >
x 2> x
real 0m0.199s
user 0m0.180s
sys 0m0.017s
[root at localhost dmd]# time src/dmd -c testSettingArrayLength.d
-bc-ctfe > x 2> x
real 0m0.072s
user 0m0.050s
sys 0m0.020s
Please note that newCTFE only spends 15 ms inside the evaluation,
most time is spent clearing the 2^^24 Bytes of heap-memory to
zero.
The sourcode of testSettingArrayLength is
uint[] MakeAndInitArr(uint length)
{
uint[] arr;
arr.length = length;
foreach(i;0 .. length)
{
arr[i] = i + 3;
}
return arr;
}
static assert(MakeAndInitArr(ushort.max).length == ushort.max);
More information about the Digitalmars-d
mailing list