perf(debug-trace-server): build the witness execution form once per block - #185
perf(debug-trace-server): build the witness execution form once per block#185flyq wants to merge 1 commit into
Conversation
…lock Every trace request deep-cloned the block's LightWitness (multi-hundred-KB kvs/levels maps) out of the shared Arc<BlockData> and then rebuilt the LightWitnessExecutor direct-lookup table from scratch — paid per debug_traceTransaction (never response-cached) and per block-level cache miss/bypass. BlockData now stores the LightWitnessExecutor, built once where the BlockData is assembled (DB load, remote fetch, fixtures), and the trace entry points borrow it; the block-data cache weigher charges the lookup table alongside the witness payload.
Claude review status
🛠️ Review did not finish Attempted head This round did not publish: MODEL_ACTION_FAILED in phase review_retry. Anything listed below is from the last round that did. Re-run the workflow or push a new commit to try again. |
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Every trace request deep-cloned the block's
LightWitnessout of the sharedArc<BlockData>(data.witness.clone()— the multi-hundred-KB-to-MBkvs/levelsmaps) and then rebuilt theLightWitnessExecutordirect-lookup table from scratch, two O(witness) passes paid on everydebug_traceTransaction(transaction responses are never response-cached) and on every block-level response-cache miss or bypass (JS, mux, struct-logger-with-flags). Surfaced by the review pass on #184 as the largest remaining hot-path allocation; pre-existing, so fixed here separately.Change
BlockData.witnessnow stores theLightWitnessExecutor— witness plus lookup table — built once where theBlockDatais assembled (DB load, remote fetch, test fixtures) and shared by every request served from that entry, including repeated traces of a hot block. The trace entry points (trace_block,trace_transaction,parity_trace_block,parity_trace_transaction) andTracingEnvborrow it (&LightWitnessExecutor); no per-request clone or table rebuild remains.LightWitnessExecutorgainslight_witness()(forextract_code_hashesand witness-size accounting) andlookup_table_memory_bytes(), which the block-data cache weigher now charges alongside the witness payload so the cache budget reflects the stored table.Testing
cargo test --workspace: 374 passed / 0 failed; clippy / fmt / cargo-sort clean.Notes
Based on #184 (
liquan/chore/upgrade-reth-2.3) — merge after it lands.