File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,37 @@ static void MuHash(benchmark::State& state)
104104 }
105105}
106106
107+ static void MuHashPrecompute (benchmark::State& state)
108+ {
109+ FastRandomContext rng (true );
110+ MuHash3072 acc;
111+ unsigned char key[32 ];
112+ std::vector<unsigned char > randkey = rng.randbytes (32 );
113+ for (int i = 0 ; i < randkey.size (); i++) {
114+ key[i] = randkey[i];
115+ }
116+
117+ while (state.KeepRunning ()) {
118+ MuHash3072 (key);
119+ }
120+ }
121+
122+ static void MuHashAdd (benchmark::State& state)
123+ {
124+ FastRandomContext rng (true );
125+ MuHash3072 acc;
126+ unsigned char key[32 ];
127+ std::vector<unsigned char > randkey = rng.randbytes (32 );
128+ for (int i = 0 ; i < randkey.size (); i++) {
129+ key[i] = randkey[i];
130+ }
131+
132+ MuHash3072 muhash = MuHash3072 (key);
133+ while (state.KeepRunning ()) {
134+ acc *= muhash;
135+ }
136+ }
137+
107138BENCHMARK (RIPEMD160, 440 );
108139BENCHMARK (SHA1, 570 );
109140BENCHMARK (SHA256, 340 );
@@ -116,3 +147,5 @@ BENCHMARK(FastRandom_32bit, 110 * 1000 * 1000);
116147BENCHMARK (FastRandom_1bit, 440 * 1000 * 1000 );
117148
118149BENCHMARK (MuHash, 5000 );
150+ BENCHMARK (MuHashPrecompute, 5000 );
151+ BENCHMARK (MuHashAdd, 5000 );
You can’t perform that action at this time.
0 commit comments