Two allocation sites on the mapping path, which is what decides how fast the sidecar allocates — the
collector was 57% of its CPU under load:
verifyTxForm allocates a map and the slice its keys are copied into, per namespace, to check for
duplicate and empty keys. For the key counts that occur in practice a pairwise comparison needs
neither.
TxRef and TxWithRef are allocated twice per transaction, and can be backed by one slice per block.
Together 61 → 56 allocations per transaction, worth 12% at the default GOGC.
Two allocation sites on the mapping path, which is what decides how fast the sidecar allocates — the
collector was 57% of its CPU under load:
verifyTxFormallocates a map and the slice its keys are copied into, per namespace, to check forduplicate and empty keys. For the key counts that occur in practice a pairwise comparison needs
neither.
TxRefandTxWithRefare allocated twice per transaction, and can be backed by one slice per block.Together 61 → 56 allocations per transaction, worth 12% at the default
GOGC.