coins: avoid redundant prevout preparation allocations #36496

pull l0rinc wants to merge 4 commits into bitcoin:master from l0rinc:l0rinc/coins-reuse-prevout-preparation changing 2 files +21 −13
  1. l0rinc commented at 3:14 PM on October 10, 2026: contributor

    Draft until reindex-chainstate performance is measured.


    Problem: Block preparation inserts an unused final transaction ID, repeatedly constructs salted transaction-ID sets, and allocates a worker-task vector. Small input queues also submit more tasks than can do useful work.

    Fix: Insert each transaction ID before scanning the following transaction's inputs. Reuse the set's buckets and hash salt and the worker-task vector across blocks. Limit submitted tasks to the smaller of the worker and queued-input counts.

  2. DrahtBot added the label UTXO Db and Indexes on Oct 10, 2026
  3. DrahtBot commented at 3:14 PM on October 10, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. coins: omit final txid from prevout classification
    Insert each transaction ID before scanning the following transaction's inputs, omitting the unused final ID.
    This reduces txid insertions from N to N-1 and replaces the separate coinbase seed and trailing insertion with one insertion at the start of the loop.
    de00c6bc2c
  5. coins: reuse prevout buckets and hash salt
    Retain the classification set across blocks to reuse its buckets and avoid reseeding its hasher.
    The set still allocates and frees its nodes for each block.
    a4bf6509a3
  6. coins: reuse prevout task vector storage
    `ThreadPool::Submit` moves individual callables without taking the vector's storage, so keep the vector on the overlay for reuse across blocks.
    696ddc5f28
  7. coins: cap prevout tasks at the input count
    Each task drains the shared input queue, so tasks beyond the number of inputs cannot do useful work.
    b0debcf4da
  8. l0rinc force-pushed on Oct 10, 2026
  9. DrahtBot added the label CI failed on Oct 10, 2026
  10. DrahtBot removed the label CI failed on Oct 10, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-11 08:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me