There is a fair amount of work going into the indices at the moment, and no cheap way to tell whether a change actually improves what it set out to improve: checking end to end means a full IBD. The only index benchmark in the tree, BlockFilterIndexSync, syncs coinbase-only blocks, so it cannot show anything that scales with what a block contains, and there is none at all for TxIndex or TxoSpenderIndex.
This adds shared helpers in src/bench/index_sync_util.{h,cpp} that build a chain of blocks with chained, validly-signed transactions (~2 inputs and ~2 outputs each, every output paying a distinct key), and on top of them, for txindex, txospenderindex and blockfilterindex:
<Index>SyncDisk/<Index>SyncMem— full sync with the index database on the filesystem, and in memory.<Index>Lookup— one query per indexed key (FindTx,FindSpender).
How far apart Disk and Mem land depends on the data directory, which defaults to a tmpfs on many Linux systems. Pointing -testdatadir at real storage is what makes the difference the cost of the write path:
| Benchmark | tmpfs (default) | ext4 via -testdatadir |
|---|---|---|
TxIndexSyncDisk |
7.0 ms | 18.1 ms |
TxIndexSyncMem |
6.5 ms | 6.8 ms |
TxIndexLookup |
13.4 us | 13.7 us |
TxoSpenderIndexSyncDisk |
8.3 ms | 23.8 ms |
TxoSpenderIndexSyncMem |
7.8 ms | 8.1 ms |
TxoSpenderIndexLookup |
13.8 us | 14.1 us |
BlockFilterIndexSyncRealisticDisk |
14.7 ms | 31.0 ms |
BlockFilterIndexSyncRealisticMem |
13.8 ms | 17.8 ms |
The existing coinbase-only BlockFilterIndexSync is left untouched. The whole suite runs in well under a minute.
I have used this on those two pull requests, and in both the interesting number was one the existing benchmark could not produce: #35531 (5-byte siphash keys) trades a 49% smaller index on disk for a lookup regression that grows with index size, and #34489 (batch db writes) cuts write syscalls by 91% with CPU unchanged. The numbers are in those threads.
Disclosure: I used claude to help me in some parts, however all code has been verified by me and I ran the bench manually on the scenarios mentioned