mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
This change allows to drop brittle sizeof calls in favor of the std::span::size method. Other improvements include: * Use of a namespace to mark test and bench data * Use of the modern std::byte * Drop of a no longer used std::vector copy and the bench/data module
22 lines
631 B
C++
22 lines
631 B
C++
// Copyright (c) 2022 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 <bench/data/block413567.raw.h>
|
|
#include <span.h>
|
|
#include <util/strencodings.h>
|
|
|
|
#include <vector>
|
|
|
|
static void HexStrBench(benchmark::Bench& bench)
|
|
{
|
|
auto const& data = benchmark::data::block413567;
|
|
bench.batch(data.size()).unit("byte").run([&] {
|
|
auto hex = HexStr(data);
|
|
ankerl::nanobench::doNotOptimizeAway(hex);
|
|
});
|
|
}
|
|
|
|
BENCHMARK(HexStrBench, benchmark::PriorityLevel::HIGH);
|