{
 "number": 36254,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36254",
 "title": "bench: add and use undo-data for BlockToJsonVerbosity3 bench",
 "author": "0xB10C",
 "author_association": "MEMBER",
 "created_at": "2026-09-14T19:56:56Z",
 "updated_at": "2026-09-15T21:54:23Z",
 "age_days": 2,
 "draft": false,
 "labels": [
  "Tests"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "0771dd89d6eec31ea39f25b283aacbf2092c7c15",
 "head_ref": "2026-09-fix-bench-getblock-v3",
 "head_repo": "0xB10C/bitcoin",
 "head_history": [
  {
   "t": "2026-09-14T21:19:08Z",
   "sha": "0771dd89d6eec31ea39f25b283aacbf2092c7c15"
  }
 ],
 "additions": 21,
 "deletions": 0,
 "changed_files": 3,
 "commit_count": 1,
 "size_bucket": "S",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "ismaelsadeeq",
      "url": "https://github.com/bitcoin/bitcoin/pull/36254#pullrequestreview-5207982442"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "ismaelsadeeq": {
   "kind": "ack",
   "hash": "0771dd89d6eec31ea39f25b283aacbf2092c7c15",
   "t": "2026-09-15T09:13:14Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 1,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 1,
  "changes_requested": 0,
  "distinct_reviewers": [
   "ismaelsadeeq",
   "sedited"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-09-15T19:23:22Z",
  "last_reviewer_activity": "2026-09-15T21:54:23Z",
  "last_reviewer": "sedited",
  "author_silent_days": 1,
  "waiting_on_author_days": 1,
  "days_since_update": 1
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "blockToJSON only includes prevouts and fees when we have undo-data. The benchmarks did not have any undo-data, so `TxVerbosity::SHOW_DETAILS` and `TxVerbosity::SHOW_DETAILS_AND_PREVOUT` did exactly the same work.\n\nThis adds the 136 KB of undo-data of block 413567 and uses it in the benchmarks.\n\n```\n$ ./build/bin/bench_bitcoin --filter=BlockToJson.* -min-time=5000\n```\n\nBefore:\n\n|               ns/op |                op/s |    err% |     total | benchmark\n|--------------------:|--------------------:|--------:|----------:|:----------\n|       10,273,470.25 |               97.34 |    0.2% |      5.51 | `BlockToJsonVerboseWrite`\n|          104,973.68 |            9,526.20 |    0.1% |      5.51 | `BlockToJsonVerbosity1`\n|       17,071,753.65 |               58.58 |    0.1% |      5.52 | `BlockToJsonVerbosity2`\n|       17,256,754.10 |               57.95 |    0.1% |      5.51 | `BlockToJsonVerbosity3`\n\nNote that the `BlockToJsonVerbosity2` and `BlockToJsonVerbosity3` times were the same.\n\nAfter:\n\n|               ns/op |                op/s |    err% |     total | benchmark\n|--------------------:|--------------------:|--------:|----------:|:----------\n|       16,207,066.75 |               61.70 |    0.7% |      5.45 | `BlockToJsonVerboseWrite`\n|          109,119.99 |            9,164.22 |    0.4% |      5.59 | `BlockToJsonVerbosity1`\n|       17,907,169.45 |               55.84 |    0.1% |      5.49 | `BlockToJsonVerbosity2`\n|       34,274,126.50 |               29.18 |    0.1% |      5.30 | `BlockToJsonVerbosity3`\n\n- `BlockToJsonVerboseWrite`: slower as it now also writes the prevouts too\n- `BlockToJsonVerbosity1`: unchanged\n- `BlockToJsonVerbosity2`: slightly slower as we now read the undo-data and calculate the fee field\n- `BlockToJsonVerbosity3`: slower as it's using undo-data now",
 "commits": [
  {
   "sha": "0771dd89d6eec31ea39f25b283aacbf2092c7c15",
   "date": "2026-09-14T21:18:58Z",
   "message": "bench: add undo-data for BlockToJsonVerbosity3\n\nblockToJSON only includes prevouts and fees when we have undo-data.\nThe benchmarks did not have any undo-data, so TxVerbosity::SHOW_DETAILS\nand TxVerbosity::SHOW_DETAILS_AND_PREVOUT did exactly the same work.\n\nThis adds the 139KB of undo-data of block 413567 and uses it in the\nbenchmarks.\n\n```\n$ ./build/bin/bench_bitcoin --filter=BlockToJson.* -min-time=5000\n```\n\nBefore:\n\n|               ns/op |                op/s |    err% |     total | benchmark\n|--------------------:|--------------------:|--------:|----------:|:----------\n|       10,273,470.25 |               97.34 |    0.2% |      5.51 | `BlockToJsonVerboseWrite`\n|          104,973.68 |            9,526.20 |    0.1% |      5.51 | `BlockToJsonVerbosity1`\n|       17,071,753.65 |               58.58 |    0.1% |      5.52 | `BlockToJsonVerbosity2`\n|       17,256,754.10 |               57.95 |    0.1% |      5.51 | `BlockToJsonVerbosity3`  (same as Verbosity2 as undo-data is missing)\n\nAfter:\n\n|               ns/op |                op/s |    err% |     total | benchmark\n|--------------------:|--------------------:|--------:|----------:|:----------\n|       16,207,066.75 |               61.70 |    0.7% |      5.45 | `BlockToJsonVerboseWrite`\n|          109,119.99 |            9,164.22 |    0.4% |      5.59 | `BlockToJsonVerbosity1`\n|       17,907,169.45 |               55.84 |    0.1% |      5.49 | `BlockToJsonVerbosity2`\n|       34,274,126.50 |               29.18 |    0.1% |      5.30 | `BlockToJsonVerbosity3`\n\n- `BlockToJsonVerboseWrite`: slower as it now also writes the prevouts too\n- `BlockToJsonVerbosity1`: unchanged\n- `BlockToJsonVerbosity2`: slightly slower as we now read the undo-data and calculate the fee field\n- `BlockToJsonVerbosity3`: slower as it's using undo-data now"
  }
 ],
 "timeline": [
  {
   "t": "2026-09-14T21:19:08Z",
   "kind": "force_push",
   "who": "0xB10C",
   "commit": "0771dd89d6eec31ea39f25b283aacbf2092c7c15"
  },
  {
   "t": "2026-09-15T09:13:14Z",
   "kind": "review",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "state": "APPROVED",
   "commit": "0771dd89d6eec31ea39f25b283aacbf2092c7c15",
   "text": "Tested ACK 0771dd89d6eec31ea39f25b283aacbf2092c7c15\n\nI reproduced the benchmark and verified the undo-data blob.\n\n| Metric | Verbosity2 ins/op | Verbosity3 ins/op |\n|--------|-------------------:|-------------------:|\n| before | 326,698,108        | 326,688,650         |\n| after  | 341,707,431         | 621,328,726         |"
  },
  {
   "t": "2026-09-15T19:23:22Z",
   "kind": "comment",
   "who": "0xB10C",
   "assoc": "MEMBER",
   "text": "As a side note:\n\nThere's also the question how reliable a block from 10 years ago is for benchmarking `BlockToJsonVerbosity3` today. The output types changed a lot and since we spend a lot of time on per-script work (address encoding, descriptor inference, checksums), the script type mix decides what the benchmark measures. With the old block, probably don't have good benchmark-coverage.\n\nWe _could_ add more recent blocks here, but not sure if that's worth the effort and repository size bloat. Maybe a crafted benchmark-block including P2PKH, P2SH, SegWit, Taproot, ... is an alternative. Or use @vostrnad's [transaction](https://mempool.space/tx/b10c0000004da5a9d1d9b4ae32e09f0b3e62d21a5cce5428d4ad714fb444eb5d) for something like this.\n\nStill worth it to fix this benchmark now. Everything else can be a followup, if fast-ish verbose getblock is important to people."
  },
  {
   "t": "2026-09-15T21:54:23Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nYou might be interested in reviewing https://github.com/bitcoin/bitcoin/pull/32554 then."
  }
 ],
 "labels_log": [
  {
   "t": "2026-09-14T19:56:59Z",
   "action": "labeled",
   "label": "Tests",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-14T20:58:09Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-14T22:32:57Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 4986,
 "text_tokens_estimate": 1246,
 "changed_paths": [
  "src/bench/CMakeLists.txt",
  "src/bench/data/block413567_undo.raw",
  "src/bench/rpc_blockchain.cpp"
 ],
 "files": [
  {
   "path": "src/bench/CMakeLists.txt",
   "add": 1,
   "del": 0
  },
  {
   "path": "src/bench/data/block413567_undo.raw",
   "add": null,
   "del": null
  },
  {
   "path": "src/bench/rpc_blockchain.cpp",
   "add": 20,
   "del": 0
  }
 ],
 "test_lines": 21,
 "git": {
  "head": "0771dd89d6eec31ea39f25b283aacbf2092c7c15",
  "head_matches_backup": true,
  "base": "cff00c547e7460fa1ec4aa1e38217793593d4263",
  "commits": [
   {
    "sha": "0771dd89d6",
    "subject": "bench: add undo-data for BlockToJsonVerbosity3",
    "files": 3,
    "add": 21,
    "del": 0
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "ff0aab1d8e881ba4",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}