Merge pull request #16 from chenshuo/master

Use a new container in each round of push_back test.
This commit is contained in:
Dominic Hamon 2014-04-17 14:38:56 -07:00
commit 98e7f89d72
3 changed files with 7 additions and 4 deletions

View File

@ -16,4 +16,5 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
Felix Homann <linuxaudio@showlabor.de>
Google Inc.
Oleksandr Sochka <sasha.sochka@gmail.com>
Shuo Chen <chenshuo@chenshuo.com>
Yusuke Suzuki <utatane.tea@gmail.com>

View File

@ -30,4 +30,5 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
Felix Homann <linuxaudio@showlabor.de>
Oleksandr Sochka <sasha.sochka@gmail.com>
Pierre Phaneuf <pphaneuf@google.com>
Shuo Chen <chenshuo@chenshuo.com>
Yusuke Suzuki <utatane.tea@gmail.com>

View File

@ -86,11 +86,12 @@ BENCHMARK(BM_SetInsert)->RangePair(1<<10,8<<10, 1,10);
template<typename Q>
static void BM_Sequential(benchmark::State& state) {
Q q;
typename Q::value_type v;
while (state.KeepRunning())
typename Q::value_type v = 42;
while (state.KeepRunning()) {
Q q;
for (int i = state.range_x(); --i; )
q.push_back(v);
}
const int64_t items_processed =
static_cast<int64_t>(state.iterations()) * state.range_x();
state.SetItemsProcessed(items_processed);