diff options
author | Pieter Wuille <pieter@wuille.net> | 2024-07-05 09:51:26 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2024-07-05 09:51:26 -0400 |
commit | 0a9bbc64c157a314e5472ecd98300e30b12d3fdf (patch) | |
tree | 7b9f14319a5c8b766a7fa338ec7abeecb99aecc1 /src/bench | |
parent | bd5d1688b4311e21c0e0ff89a3ae02ef7d0543b8 (diff) |
random bench refactor: move to new bench/random.cpp
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/crypto_hash.cpp | 18 | ||||
-rw-r--r-- | src/bench/random.cpp | 25 |
2 files changed, 25 insertions, 18 deletions
diff --git a/src/bench/crypto_hash.cpp b/src/bench/crypto_hash.cpp index 1685a120b4..2551ff3593 100644 --- a/src/bench/crypto_hash.cpp +++ b/src/bench/crypto_hash.cpp @@ -196,22 +196,6 @@ static void SipHash_32b(benchmark::Bench& bench) }); } -static void FastRandom_32bit(benchmark::Bench& bench) -{ - FastRandomContext rng(true); - bench.run([&] { - rng.rand32(); - }); -} - -static void FastRandom_1bit(benchmark::Bench& bench) -{ - FastRandomContext rng(true); - bench.run([&] { - rng.randbool(); - }); -} - static void MuHash(benchmark::Bench& bench) { MuHash3072 acc; @@ -274,8 +258,6 @@ BENCHMARK(SHA256D64_1024_STANDARD, benchmark::PriorityLevel::HIGH); BENCHMARK(SHA256D64_1024_SSE4, benchmark::PriorityLevel::HIGH); BENCHMARK(SHA256D64_1024_AVX2, benchmark::PriorityLevel::HIGH); BENCHMARK(SHA256D64_1024_SHANI, benchmark::PriorityLevel::HIGH); -BENCHMARK(FastRandom_32bit, benchmark::PriorityLevel::HIGH); -BENCHMARK(FastRandom_1bit, benchmark::PriorityLevel::HIGH); BENCHMARK(MuHash, benchmark::PriorityLevel::HIGH); BENCHMARK(MuHashMul, benchmark::PriorityLevel::HIGH); diff --git a/src/bench/random.cpp b/src/bench/random.cpp new file mode 100644 index 0000000000..124fb3d2c2 --- /dev/null +++ b/src/bench/random.cpp @@ -0,0 +1,25 @@ +// Copyright (c) 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 <random.h> + +static void FastRandom_32bit(benchmark::Bench& bench) +{ + FastRandomContext rng(true); + bench.run([&] { + rng.rand32(); + }); +} + +static void FastRandom_1bit(benchmark::Bench& bench) +{ + FastRandomContext rng(true); + bench.run([&] { + rng.randbool(); + }); +} + +BENCHMARK(FastRandom_32bit, benchmark::PriorityLevel::HIGH); +BENCHMARK(FastRandom_1bit, benchmark::PriorityLevel::HIGH); |