it doesn't cover the path, but this one does:
diff --git a/src/bench/sign_transaction.cpp b/src/bench/sign_transaction.cpp
--- a/src/bench/sign_transaction.cpp (revision 8d573611575c3fa66f08407aa9b02f91b29a94c3)
+++ b/src/bench/sign_transaction.cpp (date 1721731869277)
@@ -12,6 +12,7 @@
#include <script/script.h>
#include <script/sign.h>
#include <uint256.h>
+#include <test/util/random.h>
#include <util/translation.h>
enum class InputType {
@@ -66,5 +67,33 @@
static void SignTransactionECDSA(benchmark::Bench& bench) { SignTransactionSingleInput(bench, InputType::P2WPKH); }
static void SignTransactionSchnorr(benchmark::Bench& bench) { SignTransactionSingleInput(bench, InputType::P2TR); }
+static void SignSchnorrBenchmark(benchmark::Bench& bench, bool use_null_merkle_root)
+{
+ ECC_Context ecc_context{};
+
+ auto key = GenerateRandomKey();
+ auto msg = InsecureRand256();
+ auto merkle_root = use_null_merkle_root ? uint256() : InsecureRand256();
+ auto aux = InsecureRand256();
+ std::vector<unsigned char> sig(64);
+
+ bench.batch(1).unit("signature").run([&] {
+ bool success = key.SignSchnorr(msg, sig, &merkle_root, aux);
+ assert(success);
+ });
+}
+
+static void SignSchnorrWithMerkleRoot(benchmark::Bench& bench)
+{
+ SignSchnorrBenchmark(bench, /*use_null_merkle_root=*/false);
+}
+
+static void SignSchnorrWithNullMerkleRoot(benchmark::Bench& bench)
+{
+ SignSchnorrBenchmark(bench, /*use_null_merkle_root=*/true);
+}
+
BENCHMARK(SignTransactionECDSA, benchmark::PriorityLevel::HIGH);
BENCHMARK(SignTransactionSchnorr, benchmark::PriorityLevel::HIGH);
+BENCHMARK(SignSchnorrWithMerkleRoot, benchmark::PriorityLevel::HIGH);
+BENCHMARK(SignSchnorrWithNullMerkleRoot, benchmark::PriorityLevel::HIGH);
which reveals that the new signing is ~15% slower:
before:
| ns/signature | signature/s | err% | total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
| 69,383.89 | 14,412.57 | 0.1% | 1.06 | SignSchnorrWithMerkleRoot
| 69,548.30 | 14,378.50 | 0.0% | 1.06 | SignSchnorrWithNullMerkleRoot
| ns/signature | signature/s | err% | total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
| 70,189.31 | 14,247.18 | 0.2% | 1.07 | SignSchnorrWithMerkleRoot
| 69,464.39 | 14,395.87 | 0.1% | 1.06 | SignSchnorrWithNullMerkleRoot
after:
| ns/signature | signature/s | err% | total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
| 83,055.75 | 12,040.11 | 0.2% | 1.08 | SignSchnorrWithMerkleRoot
| 80,971.71 | 12,349.99 | 0.1% | 1.08 | SignSchnorrWithNullMerkleRoot
| ns/signature | signature/s | err% | total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
| 81,841.15 | 12,218.79 | 0.1% | 1.08 | SignSchnorrWithMerkleRoot
| 82,112.31 | 12,178.44 | 0.1% | 1.08 | SignSchnorrWithNullMerkleRoot