I need to create a multi-tree in a critical part of my code. Standard way is to use something like:
struct node{ // or class
... data ...
std::unordered_set<node*> children
};
node* root;
One important thing is that, once a node is created, on won't be deleted until the whole tree will be deleted.
The obvious way is to use the new and delete statements to manage these datas on the heap. Done.
I am wondering if it is worth exploring performances of using a std::vector instead of new/delete directly:
struct node{ // or class
... data ...
std::unordered_set<uint_32> children
};
std::vector<node> tree;
uint_32 root; // probably always 0, fist element of vector
Deleting the tree would be simply done with tree.clear();
Is there any chance that it would be faster for big (or huge) trees?