bitcoin/src/bench
MarcoFalke cd66d8b1d8
Merge #20429: refactor: replace (sizeof(a)/sizeof(a[0])) with C++17 std::size
e829c9afbf refactor: replace sizeof(a)/sizeof(a[0]) by std::size (C++17) (Sebastian Falbesoner)
365539c846 refactor: init vectors via std::{begin,end} to avoid pointer arithmetic (Sebastian Falbesoner)
63d4ee1968 refactor: iterate arrays via C++11 range-based for loops if idx is not needed (Sebastian Falbesoner)

Pull request description:

  This refactoring PR picks up the idea of #19626 and replaces all occurences of `sizeof(x)/sizeof(x[0])` (or `sizeof(x)/sizeof(*x)`, respectively) with the now-available C++17 [`std::size`](https://en.cppreference.com/w/cpp/iterator/size)  (as [suggested by sipa](https://github.com/bitcoin/bitcoin/pull/19626#issuecomment-666487228)), making the macro `ARRAYLEN` obsolete.

  As preparation for this, two other changes are done to eliminate `sizeof(x)/sizeof(x[0])` usage:
  * all places where arrays are iterated via an index are changed to use C++11 range-based for loops If the index' only purpose is to access the array element (as [suggested by MarcoFalke](https://github.com/bitcoin/bitcoin/pull/19626#discussion_r463404541)).
  * `std::vector` initializations are done via `std::begin` and `std::end` rather than using pointer arithmetic to calculate the end (also [suggested by MarcoFalke](https://github.com/bitcoin/bitcoin/pull/20429#discussion_r567418821)).

ACKs for top commit:
  practicalswift:
    cr ACK e829c9afbf: patch looks correct
  fanquake:
    ACK e829c9afbf
  MarcoFalke:
    review ACK e829c9afbf 🌩

Tree-SHA512: b01d32c04b9e04d562b7717cae00a651ec9a718645047a90761be6959e0cc2adbd67494e058fe894641076711bb09c3b47a047d0275c736f0b2218e1ce0d193d
2021-02-18 07:53:37 +01:00
..
data Add deserialize + CheckBlock benchmarks, and a full block hex 2016-11-09 11:27:59 -08:00
.gitignore Ignore bench_bitcoin binary. 2015-10-06 17:46:12 +02:00
addrman.cpp [addrman] Specify max addresses and pct when calling GetAddresses() 2020-08-12 09:22:07 +01:00
base58.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
bech32.cpp Replace current benchmarking framework with nanobench 2020-06-13 12:24:18 +02:00
bench.cpp bench: Allow skip benchmark 2020-08-14 14:56:18 +03:00
bench.h Drop boost/preprocessor dependencies 2021-02-01 22:30:06 +02:00
bench_bitcoin.cpp Merge #18011: Replace current benchmarking framework with nanobench 2020-07-30 15:34:17 +02:00
block_assemble.cpp [refactor] return MempoolAcceptResult 2021-02-09 07:01:52 -08:00
ccoins_caching.cpp Only relay Taproot spends if next block has it active 2020-10-30 15:52:19 -07:00
chacha20.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
chacha_poly_aead.cpp Do not run functions with necessary side-effects in assert() 2020-12-06 00:48:09 +00:00
checkblock.cpp Remove gArgs global from CreateChainParams to aid testing 2020-09-29 10:20:05 +02:00
checkqueue.cpp bench: Use CCheckQueue local thread pool 2020-09-24 06:55:34 +03:00
coin_selection.cpp Merge #20040: wallet: Refactor OutputGroups to handle fees and spending eligibility on grouping 2021-02-01 22:43:17 +13:00
crypto_hash.cpp bench: Add Muhash benchmarks 2020-12-21 19:57:33 +01:00
data.cpp refactor: init vectors via std::{begin,end} to avoid pointer arithmetic 2021-01-31 17:35:01 +01:00
data.h bench: Move generated data to a dedicated translation unit 2019-07-02 18:11:15 +01:00
duplicate_inputs.cpp Replace current benchmarking framework with nanobench 2020-06-13 12:24:18 +02:00
examples.cpp Replace current benchmarking framework with nanobench 2020-06-13 12:24:18 +02:00
gcs_filter.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
hashpadding.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
lockedpool.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
mempool_eviction.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
mempool_stress.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
merkle_root.cpp Replace current benchmarking framework with nanobench 2020-06-13 12:24:18 +02:00
nanobench.cpp Replace current benchmarking framework with nanobench 2020-06-13 12:24:18 +02:00
nanobench.h Replace current benchmarking framework with nanobench 2020-06-13 12:24:18 +02:00
poly1305.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
prevector.cpp Merge #20464: refactor: Treat CDataStream bytes as uint8_t 2021-02-01 15:17:28 +01:00
rollingbloom.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
rpc_blockchain.cpp Fix BlockToJsonVerbose benchmark 2021-01-24 10:31:13 +01:00
rpc_mempool.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
util_time.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
verify_script.cpp doc: fix various typos 2021-01-04 12:31:31 +08:00
wallet_balance.cpp Replace boost::optional with std::optional 2020-12-19 09:46:55 +01:00