All pastes #27079 Raw Edit

Someone

public text v1 · immutable
#27079 ·published 2005-10-30 18:39 UTC
rendered paste body
#include <vector>
#include <string>



using namespace std;

#define NUMSTRINGS 100000

vector<string> myfoo() {
  vector<string> tmpvector(NUMSTRINGS);
  for(int i=0;i<NUMSTRINGS;i++) {
    tmpvector[i]="blabla";
  }

return tmpvector;

}
void myfoo2(vector<string> &tmpvector) {
  tmpvector.clear();
  tmpvector.resize(NUMSTRINGS);
  for(int i=0;i<NUMSTRINGS;i++) {
    tmpvector[i]="blabla";
  }
}

main() {
  int i;

#if 0
  vector <string> myvec;
  for(i=0;i<300;i++) {
    myfoo2(myvec);
  }
#endif

#if 1
  for(i=0;i<300;i++) {
    vector <string> myvec = myfoo();
  }
#endif

}