Commit 66415937 by Shuo Chen

Use a new container in each round of push_back test.

Otherwise containers keep growing and uses gigabytes of memory.
parent 54cd4fd8
...@@ -86,11 +86,12 @@ BENCHMARK(BM_SetInsert)->RangePair(1<<10,8<<10, 1,10); ...@@ -86,11 +86,12 @@ 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) {
typename Q::value_type v = 42;
while (state.KeepRunning()) {
Q q; Q q;
typename Q::value_type v;
while (state.KeepRunning())
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);
......
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