On 3/22/06, Teg <[EMAIL PROTECTED]> wrote: > Hello Jay, > > Best way I've found to get great performance out of strings and > vectors is to re-use the strings and vectors. String creation speed is > completely dependent on allocation speed so, by re-using the strings, > you only grow the ones that aren't already big enough to hold the new > string data so, eventually they don't grow at all. > > At least with STLPort STL which I use, a "clear" doesn't de-allocate > the space then re-use simply fills in the already allocated space. > > With re-use, speeds are easily as fast as straight C after an initial > setup time.
Ah. There is a method to set the size of the vector if you know what it will be in advance. It's a great deal faster not to pay for all the repeated reallocation and memory movement if you can code it that way.