mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 10:30:52 +00:00
bench: add scrypt
Add an scrypt benchmark that hashes 80 byte inputs (size of a block header)
This commit is contained in:
parent
da8dae3eb3
commit
96af810b53
@ -23,7 +23,8 @@ bench_bench_dogecoin_SOURCES = \
|
||||
bench/base58.cpp \
|
||||
bench/lockedpool.cpp \
|
||||
bench/perf.cpp \
|
||||
bench/perf.h
|
||||
bench/perf.h \
|
||||
bench/scrypt.cpp
|
||||
|
||||
# bench_bench_dogecoin_SOURCES_DISABLED = \
|
||||
# bench/checkblock.cpp \ # disabled because this checks a specific bitcoin block
|
||||
|
||||
28
src/bench/scrypt.cpp
Normal file
28
src/bench/scrypt.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "bench.h"
|
||||
#include "crypto/scrypt.h"
|
||||
#include "uint256.h"
|
||||
#include "utiltime.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
||||
// 80 bytes input, size of CPureBlockHeader
|
||||
static const uint64_t BUFFER_SIZE = 80;
|
||||
|
||||
static void Scrypt(benchmark::State& state)
|
||||
{
|
||||
uint256 output;
|
||||
std::vector<char> in(BUFFER_SIZE, 0);
|
||||
|
||||
#ifdef USE_SSE2
|
||||
scrypt_detect_sse2();
|
||||
#endif // USE_SSE2
|
||||
|
||||
while (state.KeepRunning())
|
||||
{
|
||||
scrypt_1024_1_1_256(in.data(), BEGIN(output));
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(Scrypt);
|
||||
Loading…
x
Reference in New Issue
Block a user