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
This commit is contained in:
parent
20d791edfb
commit
96b1ad2ea9
@ -124,7 +124,7 @@ static void bench_ecmult_const_teardown(void* arg, int iters) {
|
|||||||
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, NULL, iters);
|
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, NULL, iters);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_ecmult_1(void* arg, int iters) {
|
static void bench_ecmult_1p(void* arg, int iters) {
|
||||||
bench_data* data = (bench_data*)arg;
|
bench_data* data = (bench_data*)arg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -133,12 +133,12 @@ static void bench_ecmult_1(void* arg, int iters) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_ecmult_1_teardown(void* arg, int iters) {
|
static void bench_ecmult_1p_teardown(void* arg, int iters) {
|
||||||
bench_data* data = (bench_data*)arg;
|
bench_data* data = (bench_data*)arg;
|
||||||
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, NULL, iters);
|
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, NULL, iters);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_ecmult_1g(void* arg, int iters) {
|
static void bench_ecmult_0p_g(void* arg, int iters) {
|
||||||
bench_data* data = (bench_data*)arg;
|
bench_data* data = (bench_data*)arg;
|
||||||
secp256k1_scalar zero;
|
secp256k1_scalar zero;
|
||||||
int i;
|
int i;
|
||||||
@ -149,12 +149,12 @@ static void bench_ecmult_1g(void* arg, int iters) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_ecmult_1g_teardown(void* arg, int iters) {
|
static void bench_ecmult_0p_g_teardown(void* arg, int iters) {
|
||||||
bench_data* data = (bench_data*)arg;
|
bench_data* data = (bench_data*)arg;
|
||||||
bench_ecmult_teardown_helper(data, NULL, NULL, &data->offset1, iters);
|
bench_ecmult_teardown_helper(data, NULL, NULL, &data->offset1, iters);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_ecmult_2g(void* arg, int iters) {
|
static void bench_ecmult_1p_g(void* arg, int iters) {
|
||||||
bench_data* data = (bench_data*)arg;
|
bench_data* data = (bench_data*)arg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ static void bench_ecmult_2g(void* arg, int iters) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_ecmult_2g_teardown(void* arg, int iters) {
|
static void bench_ecmult_1p_g_teardown(void* arg, int iters) {
|
||||||
bench_data* data = (bench_data*)arg;
|
bench_data* data = (bench_data*)arg;
|
||||||
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, &data->offset1, iters/2);
|
bench_ecmult_teardown_helper(data, &data->offset1, &data->offset2, &data->offset1, iters/2);
|
||||||
}
|
}
|
||||||
@ -175,14 +175,14 @@ static void run_ecmult_bench(bench_data* data, int iters) {
|
|||||||
sprintf(str, "ecmult_const");
|
sprintf(str, "ecmult_const");
|
||||||
run_benchmark(str, bench_ecmult_const, bench_ecmult_setup, bench_ecmult_const_teardown, data, 10, iters);
|
run_benchmark(str, bench_ecmult_const, bench_ecmult_setup, bench_ecmult_const_teardown, data, 10, iters);
|
||||||
/* ecmult with non generator point */
|
/* ecmult with non generator point */
|
||||||
sprintf(str, "ecmult 1");
|
sprintf(str, "ecmult_1p");
|
||||||
run_benchmark(str, bench_ecmult_1, bench_ecmult_setup, bench_ecmult_1_teardown, data, 10, iters);
|
run_benchmark(str, bench_ecmult_1p, bench_ecmult_setup, bench_ecmult_1p_teardown, data, 10, iters);
|
||||||
/* ecmult with generator point */
|
/* ecmult with generator point */
|
||||||
sprintf(str, "ecmult 1g");
|
sprintf(str, "ecmult_0p_g");
|
||||||
run_benchmark(str, bench_ecmult_1g, bench_ecmult_setup, bench_ecmult_1g_teardown, data, 10, iters);
|
run_benchmark(str, bench_ecmult_0p_g, bench_ecmult_setup, bench_ecmult_0p_g_teardown, data, 10, iters);
|
||||||
/* ecmult with generator and non-generator point. The reported time is per point. */
|
/* ecmult with generator and non-generator point. The reported time is per point. */
|
||||||
sprintf(str, "ecmult 2g");
|
sprintf(str, "ecmult_1p_g");
|
||||||
run_benchmark(str, bench_ecmult_2g, bench_ecmult_setup, bench_ecmult_2g_teardown, data, 10, 2*iters);
|
run_benchmark(str, bench_ecmult_1p_g, bench_ecmult_setup, bench_ecmult_1p_g_teardown, data, 10, 2*iters);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bench_ecmult_multi_callback(secp256k1_scalar* sc, secp256k1_ge* ge, size_t idx, void* arg) {
|
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_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Run the benchmark. */
|
/* Run the benchmark. */
|
||||||
sprintf(str, includes_g ? "ecmult_multi %ig" : "ecmult_multi %i", (int)count);
|
if (includes_g) {
|
||||||
|
sprintf(str, "ecmult_multi_%ip_g", (int)count - 1);
|
||||||
|
} else {
|
||||||
|
sprintf(str, "ecmult_multi_%ip", (int)count);
|
||||||
|
}
|
||||||
run_benchmark(str, bench_ecmult_multi, bench_ecmult_multi_setup, bench_ecmult_multi_teardown, data, 10, count * iters);
|
run_benchmark(str, bench_ecmult_multi, bench_ecmult_multi_setup, bench_ecmult_multi_teardown, data, 10, count * iters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user