Commit f64306a
committed
eckey: speed up
Rather than using the generic double multiply (with na=1), use the
newly introduced fast variable-time generator point multiplication
and add it up to the base public key manually.
On arm64, this improves the performance of the
`secp256k1_ec_pubkey_tweak_add` API function by about 80%:
----- Before (prior this commit): -----
```
$ ./build/bin/bench tweak
Benchmark , Min(us) , Avg(us) , Max(us)
ec_pk_tweak_add , 16.1 , 16.2 , 16.6
```
----- After (this commit): -----
```
$ ./build/bin/bench tweak
Benchmark , Min(us) , Avg(us) , Max(us)
ec_pk_tweak_add , 8.94 , 8.98 , 9.29
```
Note that the following API functions also benefit from the improved code path:
- secp256k1_xonly_pubkey_tweak_add
- secp256k1_xonly_pubkey_tweak_add_check
(this one is consensus-critical for P2TR script path spends, see BIP341)
- secp256k1_keypair_xonly_tweak_add
- secp256k1_musig_pubkey_ec_tweak_add
- secp256k1_musig_pubkey_xonly_tweak_add_pubkey_tweak_add by using ecmult_gen_var1 parent 8de10c7 commit f64306a
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
0 commit comments