Commit 98e7f89d by Dominic Hamon

Merge pull request #16 from chenshuo/master

Use a new container in each round of push_back test.
parents 54cd4fd8 e474629b
...@@ -16,4 +16,5 @@ Eugene Zhuk <eugene.zhuk@gmail.com> ...@@ -16,4 +16,5 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
Felix Homann <linuxaudio@showlabor.de> Felix Homann <linuxaudio@showlabor.de>
Google Inc. Google Inc.
Oleksandr Sochka <sasha.sochka@gmail.com> Oleksandr Sochka <sasha.sochka@gmail.com>
Shuo Chen <chenshuo@chenshuo.com>
Yusuke Suzuki <utatane.tea@gmail.com> Yusuke Suzuki <utatane.tea@gmail.com>
...@@ -30,4 +30,5 @@ Eugene Zhuk <eugene.zhuk@gmail.com> ...@@ -30,4 +30,5 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
Felix Homann <linuxaudio@showlabor.de> Felix Homann <linuxaudio@showlabor.de>
Oleksandr Sochka <sasha.sochka@gmail.com> Oleksandr Sochka <sasha.sochka@gmail.com>
Pierre Phaneuf <pphaneuf@google.com> Pierre Phaneuf <pphaneuf@google.com>
Shuo Chen <chenshuo@chenshuo.com>
Yusuke Suzuki <utatane.tea@gmail.com> Yusuke Suzuki <utatane.tea@gmail.com>
...@@ -86,12 +86,13 @@ BENCHMARK(BM_SetInsert)->RangePair(1<<10,8<<10, 1,10); ...@@ -86,12 +86,13 @@ BENCHMARK(BM_SetInsert)->RangePair(1<<10,8<<10, 1,10);
template<typename Q> template<typename Q>
static void BM_Sequential(benchmark::State& state) { static void BM_Sequential(benchmark::State& state) {
Q q; typename Q::value_type v = 42;
typename Q::value_type v; while (state.KeepRunning()) {
while (state.KeepRunning()) Q q;
for (int i = state.range_x(); --i; ) for (int i = state.range_x(); --i; )
q.push_back(v); q.push_back(v);
const int64_t items_processed = }
const int64_t items_processed =
static_cast<int64_t>(state.iterations()) * state.range_x(); static_cast<int64_t>(state.iterations()) * state.range_x();
state.SetItemsProcessed(items_processed); state.SetItemsProcessed(items_processed);
state.SetBytesProcessed(items_processed * sizeof(v)); state.SetBytesProcessed(items_processed * sizeof(v));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment