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 :)