Skip to content

Commit 96b1ad2

Browse files
committed
bench_ecmult: improve clarity of output
Previously "ecmult{,_multi} xg" meant multiplication with (x - 1) random points and base point G. Now - ecmult_{,multi_}xp means multiplication with x random points and - ecmult_{,multi_}xp_g means multiplication with x random points and G
1 parent 20d791e commit 96b1ad2

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/bench_ecmult.c

+17-13
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void bench_ecmult_const_teardown(void* arg, int iters) {
124124
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, NULL, iters);
125125
}
126126

127-
static void bench_ecmult_1(void* arg, int iters) {
127+
static void bench_ecmult_1p(void* arg, int iters) {
128128
bench_data* data = (bench_data*)arg;
129129
int i;
130130

@@ -133,12 +133,12 @@ static void bench_ecmult_1(void* arg, int iters) {
133133
}
134134
}
135135

136-
static void bench_ecmult_1_teardown(void* arg, int iters) {
136+
static void bench_ecmult_1p_teardown(void* arg, int iters) {
137137
bench_data* data = (bench_data*)arg;
138138
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, NULL, iters);
139139
}
140140

141-
static void bench_ecmult_1g(void* arg, int iters) {
141+
static void bench_ecmult_0p_g(void* arg, int iters) {
142142
bench_data* data = (bench_data*)arg;
143143
secp256k1_scalar zero;
144144
int i;
@@ -149,12 +149,12 @@ static void bench_ecmult_1g(void* arg, int iters) {
149149
}
150150
}
151151

152-
static void bench_ecmult_1g_teardown(void* arg, int iters) {
152+
static void bench_ecmult_0p_g_teardown(void* arg, int iters) {
153153
bench_data* data = (bench_data*)arg;
154154
bench_ecmult_teardown_helper(data, NULL, NULL, &data->offset1, iters);
155155
}
156156

157-
static void bench_ecmult_2g(void* arg, int iters) {
157+
static void bench_ecmult_1p_g(void* arg, int iters) {
158158
bench_data* data = (bench_data*)arg;
159159
int i;
160160

@@ -163,7 +163,7 @@ static void bench_ecmult_2g(void* arg, int iters) {
163163
}
164164
}
165165

166-
static void bench_ecmult_2g_teardown(void* arg, int iters) {
166+
static void bench_ecmult_1p_g_teardown(void* arg, int iters) {
167167
bench_data* data = (bench_data*)arg;
168168
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, &data->offset1, iters/2);
169169
}
@@ -175,14 +175,14 @@ static void run_ecmult_bench(bench_data* data, int iters) {
175175
sprintf(str, "ecmult_const");
176176
run_benchmark(str, bench_ecmult_const, bench_ecmult_setup, bench_ecmult_const_teardown, data, 10, iters);
177177
/* ecmult with non generator point */
178-
sprintf(str, "ecmult 1");
179-
run_benchmark(str, bench_ecmult_1, bench_ecmult_setup, bench_ecmult_1_teardown, data, 10, iters);
178+
sprintf(str, "ecmult_1p");
179+
run_benchmark(str, bench_ecmult_1p, bench_ecmult_setup, bench_ecmult_1p_teardown, data, 10, iters);
180180
/* ecmult with generator point */
181-
sprintf(str, "ecmult 1g");
182-
run_benchmark(str, bench_ecmult_1g, bench_ecmult_setup, bench_ecmult_1g_teardown, data, 10, iters);
181+
sprintf(str, "ecmult_0p_g");
182+
run_benchmark(str, bench_ecmult_0p_g, bench_ecmult_setup, bench_ecmult_0p_g_teardown, data, 10, iters);
183183
/* ecmult with generator and non-generator point. The reported time is per point. */
184-
sprintf(str, "ecmult 2g");
185-
run_benchmark(str, bench_ecmult_2g, bench_ecmult_setup, bench_ecmult_2g_teardown, data, 10, 2*iters);
184+
sprintf(str, "ecmult_1p_g");
185+
run_benchmark(str, bench_ecmult_1p_g, bench_ecmult_setup, bench_ecmult_1p_g_teardown, data, 10, 2*iters);
186186
}
187187

188188
static int bench_ecmult_multi_callback(secp256k1_scalar* sc, secp256k1_ge* ge, size_t idx, void* arg) {
@@ -270,7 +270,11 @@ static void run_ecmult_multi_bench(bench_data* data, size_t count, int includes_
270270
}
271271

272272
/* Run the benchmark. */
273-
sprintf(str, includes_g ? "ecmult_multi %ig" : "ecmult_multi %i", (int)count);
273+
if (includes_g) {
274+
sprintf(str, "ecmult_multi_%ip_g", (int)count - 1);
275+
} else {
276+
sprintf(str, "ecmult_multi_%ip", (int)count);
277+
}
274278
run_benchmark(str, bench_ecmult_multi, bench_ecmult_multi_setup, bench_ecmult_multi_teardown, data, 10, count * iters);
275279
}
276280

0 commit comments

Comments
 (0)