CTFE Status

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 19 03:22:18 PST 2016


On Saturday, 19 November 2016 at 09:42:33 UTC, Stefan Koch wrote:
> Another small update.
> I got rid of the heapClearing overhead.
> By using ddmds allocator.
> Because of that I was able to shave off 20ms overhead.

Allocation of dynamic arrays works :)
The following code will work just fine with the new engine.
uint[] repeat(uint[] a, uint cnt)
{
   uint[] result = [];
   uint pos;
   result.length = cast(uint) (a.length * cnt);
   while(cnt--) foreach(c;a)
   {
     result[pos++] = c;
   }

   return result;
}

static assert(repeat([1,2,3,4], 4) ==
   [1,2,3,4, 1,2,3,4, 1,2,3,4, 1,2,3,4]
);




More information about the Digitalmars-d mailing list