forked from dogecoin/dogecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an scrypt benchmark that hashes 80 byte inputs (size of a block header)
- Loading branch information
1 parent
da8dae3
commit 96af810
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |