N
nandor.sieben
I am using a small set of functions that implements an n-ary tree. The
library is disscusses here:
http://groups.google.com/group/comp...ef3f22fdb90?lnk=gst&q=sieben#8d274ef3f22fdb90
The nodes of the tree are cretaed and erased by new and delete. I just
read in Modern C++ Design that new/delete can be very inefficient. I
am using this library to search in game trees so I do create and erase
a lot of nodes. Would I be better of by creating a large vector
containing nodes and use this vector to store my tree nodes. Instead
of pointers I could use indices. The unused nodes would be linked
together for easy access and used only when a new node is needed. This
would avoid the use of new/delete. The only drawback is that the
memory is allocated even when it's not used, but this is not really an
issue for my application.
Should I expect a significant gain in performance from this?
library is disscusses here:
http://groups.google.com/group/comp...ef3f22fdb90?lnk=gst&q=sieben#8d274ef3f22fdb90
The nodes of the tree are cretaed and erased by new and delete. I just
read in Modern C++ Design that new/delete can be very inefficient. I
am using this library to search in game trees so I do create and erase
a lot of nodes. Would I be better of by creating a large vector
containing nodes and use this vector to store my tree nodes. Instead
of pointers I could use indices. The unused nodes would be linked
together for easy access and used only when a new node is needed. This
would avoid the use of new/delete. The only drawback is that the
memory is allocated even when it's not used, but this is not really an
issue for my application.
Should I expect a significant gain in performance from this?