mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Add prevector destructor benchmark
This commit is contained in:
parent
07fd147b9f
commit
aaa02e7f24
@ -24,7 +24,8 @@ bench_bench_bitcoin_SOURCES = \
|
||||
bench/base58.cpp \
|
||||
bench/lockedpool.cpp \
|
||||
bench/perf.cpp \
|
||||
bench/perf.h
|
||||
bench/perf.h \
|
||||
bench/prevector_destructor.cpp
|
||||
|
||||
nodist_bench_bench_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
||||
|
||||
|
36
src/bench/prevector_destructor.cpp
Normal file
36
src/bench/prevector_destructor.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2015-2017 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "bench.h"
|
||||
#include "prevector.h"
|
||||
|
||||
static void PrevectorDestructor(benchmark::State& state)
|
||||
{
|
||||
while (state.KeepRunning()) {
|
||||
for (auto x = 0; x < 1000; ++x) {
|
||||
prevector<28, unsigned char> t0;
|
||||
prevector<28, unsigned char> t1;
|
||||
t0.resize(28);
|
||||
t1.resize(29);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void PrevectorClear(benchmark::State& state)
|
||||
{
|
||||
|
||||
while (state.KeepRunning()) {
|
||||
for (auto x = 0; x < 1000; ++x) {
|
||||
prevector<28, unsigned char> t0;
|
||||
prevector<28, unsigned char> t1;
|
||||
t0.resize(28);
|
||||
t0.clear();
|
||||
t1.resize(29);
|
||||
t0.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(PrevectorDestructor);
|
||||
BENCHMARK(PrevectorClear);
|
Loading…
Reference in New Issue
Block a user