Commit message · merge-scriptMerge bitcoin/bitcoin#36475: bench: add BIP-352 pubkey extraction benchmarks (standard + P2PKH worst-case)
56c0f168d1a81b19e4cd71ef81e7ce2d9c1624e3 bench: add worst-case P2PKH benchmark for BIP-352 pubkey extraction (Sebastian Falbesoner)
d71bc7127f0ce06da96476456160799e817f0a14 bench: add benchmarks for BIP-352 pubkey extraction (standard inputs) (Sebastian Falbesoner)
Pull request description:
As there are ongoing changes to the Silent Payments public key extraction function `GetPubKeyFromInput` (see recently merged #36338), it seems reasonable to add benchmarks for it. The first commit covers the standard shape of each eligible input type (P2PKH, P2SH-P2WPKH, P2WPKH and P2TR script-path spend; see [BIP-352](https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki#user-content-Inputs_For_Shared_Secret_Derivation)). The second adds a worst-case P2PKH input with a maximally malleated scriptSig, where every push has to be hashed during the scan.
Results on my arm64 machine (as per `$ ./build/bin/bench_bitcoin -filter='BIP352_.*'`):
| ns/input | input/s | err% | total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
| 3,034.12 | 329,584.35 | 0.2% | 0.01 | `BIP352_GetPubKey_P2PKH`
| 69,868.20 | 14,312.66 | 0.1% | 0.01 | `BIP352_GetPubKey_P2PKH_WorstCase`
| 2,841.35 | 351,945.44 | 0.1% | 0.01 | `BIP352_GetPubKey_P2SH_P2WPKH`
| 2,768.00 | 361,272.01 | 0.1% | 0.01 | `BIP352_GetPubKey_P2TR`
| 2,757.57 | 362,637.66 | 0.0% | 0.01 | `BIP352_GetPubKey_P2WPKH`
ACKs for top commit:
Yudis-bit:
re-tACK 56c0f168d1
fametrano:
tACK 56c0f168d1
Eunovo:
ACK https://github.com/bitcoin/bitcoin/pull/36475/commits/56c0f168d1a81b19e4cd71ef81e7ce2d9c1624e3
Tree-SHA512: 86ab61570fe2cec16afbab007d4a4d443ca18ff963797971a39ce75993a837562245a21c3daeb9ced9d88ca9a2eff037e8bc4353e159ae0bf4b5610007ac1dab
81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queuedmerge-commit duplicate discount