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 7
7
#include " bench.h"
8
8
#include " bloom.h"
9
9
#include " hash.h"
10
+ #include " random.h"
10
11
#include " uint256.h"
11
12
#include " utiltime.h"
12
13
#include " crypto/ripemd160.h"
@@ -69,10 +70,34 @@ static void SipHash_32b(benchmark::State& state)
69
70
}
70
71
}
71
72
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
+
72
95
BENCHMARK (RIPEMD160);
73
96
BENCHMARK (SHA1);
74
97
BENCHMARK (SHA256);
75
98
BENCHMARK (SHA512);
76
99
77
100
BENCHMARK (SHA256_32b);
78
101
BENCHMARK (SipHash_32b);
102
+ BENCHMARK (FastRandom_32bit);
103
+ BENCHMARK (FastRandom_1bit);
You can’t perform that action at this time.
0 commit comments