Fast GC allocation of many small objects

rikki cattermole rikki at cattermole.co.nz
Fri Mar 30 20:38:35 UTC 2018


On 31/03/2018 9:31 AM, Per Nordlöw wrote:
> I'm working on a graph database with tens of millions of small nodes 
> containing typically around 8-64 bytes of member data. Is there a faster 
> way of allocating many small class objects such as
> 
> class Node
> {
>      // abstract members
> }
> 
> class StrNode : Node
> {
>      string value;
> }
> 
> // more Node-types...
> 
> other than
> 
> const nodeCount = 10_000_000;
> foreach (0 .. n)
> {
>      auto node = new Node(someData);
>      // connect node...
> }

Use a custom allocator (that could be backed by the GC) using 
std.experimental.allocators :)


More information about the Digitalmars-d-learn mailing list