|
|
@ -7,6 +7,7 @@ |
|
|
|
#include "bench.h" |
|
|
|
#include "bench.h" |
|
|
|
#include "bloom.h" |
|
|
|
#include "bloom.h" |
|
|
|
#include "hash.h" |
|
|
|
#include "hash.h" |
|
|
|
|
|
|
|
#include "random.h" |
|
|
|
#include "uint256.h" |
|
|
|
#include "uint256.h" |
|
|
|
#include "utiltime.h" |
|
|
|
#include "utiltime.h" |
|
|
|
#include "crypto/ripemd160.h" |
|
|
|
#include "crypto/ripemd160.h" |
|
|
@ -69,6 +70,28 @@ static void SipHash_32b(benchmark::State& state) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void FastRandom_32bit(benchmark::State& state) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
FastRandomContext rng(true); |
|
|
|
|
|
|
|
uint32_t x; |
|
|
|
|
|
|
|
while (state.KeepRunning()) { |
|
|
|
|
|
|
|
for (int i = 0; i < 1000000; i++) { |
|
|
|
|
|
|
|
x += rng.rand32(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void FastRandom_1bit(benchmark::State& state) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
FastRandomContext rng(true); |
|
|
|
|
|
|
|
uint32_t x; |
|
|
|
|
|
|
|
while (state.KeepRunning()) { |
|
|
|
|
|
|
|
for (int i = 0; i < 1000000; i++) { |
|
|
|
|
|
|
|
x += rng.randbool(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BENCHMARK(RIPEMD160); |
|
|
|
BENCHMARK(RIPEMD160); |
|
|
|
BENCHMARK(SHA1); |
|
|
|
BENCHMARK(SHA1); |
|
|
|
BENCHMARK(SHA256); |
|
|
|
BENCHMARK(SHA256); |
|
|
@ -76,3 +99,5 @@ BENCHMARK(SHA512); |
|
|
|
|
|
|
|
|
|
|
|
BENCHMARK(SHA256_32b); |
|
|
|
BENCHMARK(SHA256_32b); |
|
|
|
BENCHMARK(SipHash_32b); |
|
|
|
BENCHMARK(SipHash_32b); |
|
|
|
|
|
|
|
BENCHMARK(FastRandom_32bit); |
|
|
|
|
|
|
|
BENCHMARK(FastRandom_1bit); |
|
|
|