Coin Brief ENDE

rippled stops re-parsing and copying transactions on relay, shortening time under masterLock

Two performance changes merged into rippled, the reference XRP Ledger server, on 10 November target the same path: what happens to a transaction after it is accepted and before it is sent to peers. Both were opened by contributor mvadari and both note that part of the work runs while NetworkOPs holds its masterLock, so the saving also shortens the time that lock is held.

The larger one, PR #8593, adds an overload of Overlay::relay that takes the STTx object the caller has already parsed. Until now the relay function rebuilt a full STTx from the raw message, including parsing, applying the template, hashing and building any batch, only to check whether it was a pseudo-transaction. Two of its three callers, the apply step in NetworkOPs and the recovery path in OpenLedger::accept, already held the parsed object. The consensus share path in RCLConsensus only has raw bytes from the transaction set, which can contain pseudo-transactions, so it keeps the parsing version, and malformed bytes from there are still not relayed. Both versions now funnel into one private function with unchanged peer-selection logic.

The author's benchmark, a temporary unit test on Apple M-series hardware with no peers attached so that parsing dominates, measured relaying a NoOp transaction at about 1,890 nanoseconds before and about 106 after. With peers connected the per-peer send cost is unchanged; the saving is one parse per relayed transaction. New test cases cover a parsed transaction being sent to every peer and parsed and unparsed pseudo-transactions being queued, not sent.

PR #8582 is a two-line change. Two places in NetworkOPs used a copy of the transaction where a const reference was enough, because the code only reads a flag, serialises the transaction and checks validity. In a Google Benchmark of the relay block, time fell from about 814 to 399 nanoseconds. End-to-end submit tests showed no change beyond noise, which the author says is expected for less than a microsecond per transaction.

Both pull requests say they were written with AI assistance.

rippled stops re-parsing and copying transactions on relay, shortening time under masterLock
rippled stops re-parsing and copying transactions on relay, shortening time under masterLock — Coin Brief

Why it matters

Neither change alters behaviour or the API; they remove repeated work from the busiest path a validator runs. The honest part is in the numbers: large gains in isolation, invisible end to end, but fewer cycles spent while a global lock is held.

Primary source
XRPLF/rippled on GitHub
https://github.com/XRPLF/rippled/pull/8593
Written by Victoria Shinder.