mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-04 00:41:36 +02:00
* inline performance critical code * Average runtime is specified and used to calculate iterations. * Console: show median of multiple runs * plot: show box plot * filter benchmarks * specify scaling factor * ignore src/test and src/bench in command line check script * number of iterations instead of time * Replaced runtime in BENCHMARK makro number of iterations. * Added -? to bench_bitcoin * Benchmark plotly.js URL, width, height can be customized * Fixed incorrect precision warning
37 lines
955 B
C++
37 lines
955 B
C++
// 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/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, 5700);
|
|
BENCHMARK(PrevectorClear, 5600);
|