Raven Core  3.0.0
P2P Digital Currency
prevector_destructor.cpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2017 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #include "bench.h"
7 #include "prevector.h"
8 
9 static void PrevectorDestructor(benchmark::State& state)
10 {
11  while (state.KeepRunning()) {
12  for (auto x = 0; x < 1000; ++x) {
15  t0.resize(28);
16  t1.resize(29);
17  }
18  }
19 }
20 
21 static void PrevectorClear(benchmark::State& state)
22 {
23 
24  while (state.KeepRunning()) {
25  for (auto x = 0; x < 1000; ++x) {
28  t0.resize(28);
29  t0.clear();
30  t1.resize(29);
31  t0.clear();
32  }
33  }
34 }
35 
36 BENCHMARK(PrevectorDestructor);
37 BENCHMARK(PrevectorClear);
void resize(size_type new_size)
Definition: prevector.h:317
void clear()
Definition: prevector.h:340
bool KeepRunning()
Definition: bench.cpp:44
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
Definition: prevector.h:37
BENCHMARK(PrevectorDestructor)