File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 77#include " bench.h"
88#include " bloom.h"
99#include " hash.h"
10+ #include " random.h"
1011#include " uint256.h"
1112#include " utiltime.h"
1213#include " crypto/ripemd160.h"
@@ -69,10 +70,34 @@ static void SipHash_32b(benchmark::State& state)
6970 }
7071}
7172
73+ static void FastRandom_32bit (benchmark::State& state)
74+ {
75+ FastRandomContext rng (true );
76+ uint32_t x;
77+ while (state.KeepRunning ()) {
78+ for (int i = 0 ; i < 1000000 ; i++) {
79+ x += rng.rand32 ();
80+ }
81+ }
82+ }
83+
84+ static void FastRandom_1bit (benchmark::State& state)
85+ {
86+ FastRandomContext rng (true );
87+ uint32_t x;
88+ while (state.KeepRunning ()) {
89+ for (int i = 0 ; i < 1000000 ; i++) {
90+ x += rng.randbool ();
91+ }
92+ }
93+ }
94+
7295BENCHMARK (RIPEMD160);
7396BENCHMARK (SHA1);
7497BENCHMARK (SHA256);
7598BENCHMARK (SHA512);
7699
77100BENCHMARK (SHA256_32b);
78101BENCHMARK (SipHash_32b);
102+ BENCHMARK (FastRandom_32bit);
103+ BENCHMARK (FastRandom_1bit);
You can’t perform that action at this time.
0 commit comments