Fast GC allocation of many small objects

Per Nordlöw per.nordlow at gmail.com
Sat Mar 31 20:17:26 UTC 2018


On Friday, 30 March 2018 at 23:09:33 UTC, Alexandru Jercaianu 
wrote:
> Hello,
>
> You can try the following:
>     struct Node
>     {
>         char[64] arr;
>     }
>
>      enum numNodes = 100_000_000;
>      void[] buf = GCAllocator.instance.allocate(numNodes * 
> Node.sizeof);
>      auto reg = Region!(NullAllocator, 16)(cast(ubyte[])buf);

Thanks!

Is a `minAlign` of 16 recommended over 8 when allocating classes 
or arrays?


More information about the Digitalmars-d-learn mailing list