mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 20:23:35 +01:00
test: Use span for raw data
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
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include(GenerateHeaders)
|
||||
generate_header_from_raw(data/block413567.raw)
|
||||
generate_header_from_raw(data/block413567.raw benchmark::data)
|
||||
|
||||
add_executable(bench_bitcoin
|
||||
bench_bitcoin.cpp
|
||||
bench.cpp
|
||||
data.cpp
|
||||
nanobench.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/data/block413567.raw.h
|
||||
# Benchmarks:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <bench/data.h>
|
||||
#include <bench/data/block413567.raw.h>
|
||||
#include <chainparams.h>
|
||||
#include <common/args.h>
|
||||
#include <consensus/validation.h>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2019-2021 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/data.h>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace benchmark {
|
||||
namespace data {
|
||||
|
||||
#include <bench/data/block413567.raw.h>
|
||||
const std::vector<uint8_t> block413567{std::begin(block413567_raw), std::end(block413567_raw)};
|
||||
|
||||
} // namespace data
|
||||
} // namespace benchmark
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright (c) 2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_BENCH_DATA_H
|
||||
#define BITCOIN_BENCH_DATA_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace benchmark {
|
||||
namespace data {
|
||||
|
||||
extern const std::vector<uint8_t> block413567;
|
||||
|
||||
} // namespace data
|
||||
} // namespace benchmark
|
||||
|
||||
#endif // BITCOIN_BENCH_DATA_H
|
||||
@@ -3,7 +3,7 @@
|
||||
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <bench/data.h>
|
||||
#include <bench/data/block413567.raw.h>
|
||||
#include <chainparams.h>
|
||||
#include <flatfile.h>
|
||||
#include <node/blockstorage.h>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <bench/data.h>
|
||||
#include <bench/data/block413567.raw.h>
|
||||
#include <flatfile.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <primitives/block.h>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <bench/data.h>
|
||||
#include <bench/data/block413567.raw.h>
|
||||
#include <chain.h>
|
||||
#include <core_io.h>
|
||||
#include <primitives/block.h>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <bench/data.h>
|
||||
#include <bench/data/block413567.raw.h>
|
||||
#include <span.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user