-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprogpow.cpp
37 lines (31 loc) · 1011 Bytes
/
progpow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2019-2022 Xenios SEZC
// https://www.veriblock.org
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
#include <benchmark/benchmark.h>
#include <veriblock/pop/literals.hpp>
#include <veriblock/pop/stateless_validation.hpp>
using namespace altintegration;
static void ProgpowEpochCached(benchmark::State& state) {
VbkBlock block;
block.setHeight(0);
block.getHash();
for (auto _ : state) {
block.setHeight((block.getHeight() + 1) % 8000);
benchmark::DoNotOptimize(block.getHash());
}
}
static void ProgpowEpochUnCached(benchmark::State& state) {
VbkBlock block;
block.setHeight(8000);
for (auto _ : state) {
block.setHeight(block.getHeight() + 8000);
benchmark::DoNotOptimize(block.getHash());
}
}
BENCHMARK(ProgpowEpochCached)->Unit(benchmark::kMillisecond);
;
BENCHMARK(ProgpowEpochUnCached)->Unit(benchmark::kMillisecond);
;
// Run the benchmark
BENCHMARK_MAIN();