- 258 名前:235 mailto:sage [2009/07/22(水) 17:52:39 ]
- >>255
とりあえず、ささっと速度比較書いてみる。 push_backは怖くて実験しなかった。 boost::timer t; std::vector<int> hoge; std::vector<int>::iterator it; hoge.resize(1000000); for(int i=0;i<1000000;i++) hoge[i] = rand(); for(it=hoge.begin();it!=hoge.end();it++) { (*it) += rand(); } printf("%f\n", t.elapsed()); printf("%d\n", hoge[rand()]); アホなテストコードなのは分かっているが。 Debugモードは9秒、Releaseモードは0.09秒。実に100倍の遅さ。 最適化かけてループ部を省略されてるのでは、と言われそうなので、 一応、むやみにrand()突っ込みまくっておいた。 >>257 おぉ、その単語は知らなかった。 ちょっと今から出かけるので、帰ったらやってみます。
|

|