------- Comment #2 from neundorf at kde dot org 2006-09-12 17:04 ------- The use case here is as follows:
std::string cacheKey; cacheKey.resize(4*1024); for (...several files...) { cacheKey=current.FileName; // <- this is the critical line for(std::vector<std::string>::const_iterator i = this->IncludePath->begin(); i != this->IncludePath->end(); ++i) { cacheKey+=*i; } ... do something } So in the line cacheKey=current.FileName; the allocated memory from the last loop iteration is thrown away, and then allocated again bit by bit while appending the strings contained in the vector. Changing the line to cacheKey=current.FileName.c_str(); brought the execution time in one example from 19 seconds down to 15 seconds. Alex -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29037