snapshotFromValidTxs builds txIds = Set.fromList (map txId validTxs) for snapshotHasTx on every snapshot.
getSnapshot calls it per invocation, and the tx-submission mempool reader snapshots on every read, so the O(n log n) rebuild runs often.
The InternalState already maintains isTxIds :: Set (GenTxId blk) incrementally.
The snapshotFromIS/getSnapshot path could reuse it instead of rebuilding.
(The revalidation path computeSnapshot builds a fresh tx list, so it would still rebuild.)
Orthogonal to #2003: this is about how often the set is built, not the per-comparison cost.
Found while analysing #2003.
snapshotFromValidTxsbuildstxIds = Set.fromList (map txId validTxs)forsnapshotHasTxon every snapshot.getSnapshotcalls it per invocation, and the tx-submission mempool reader snapshots on every read, so theO(n log n)rebuild runs often.The InternalState already maintains
isTxIds :: Set (GenTxId blk)incrementally.The
snapshotFromIS/getSnapshotpath could reuse it instead of rebuilding.(The revalidation path
computeSnapshotbuilds a fresh tx list, so it would still rebuild.)Orthogonal to #2003: this is about how often the set is built, not the per-comparison cost.
Found while analysing #2003.