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]
);


Reply via email to