Skip to content

perf: remove unnecessary clone in transaction execution loop#106

Open
KENILSHAHH wants to merge 1 commit intomegaeth-labs:mainfrom
KENILSHAHH:kenil/perf/remove-clone
Open

perf: remove unnecessary clone in transaction execution loop#106
KENILSHAHH wants to merge 1 commit intomegaeth-labs:mainfrom
KENILSHAHH:kenil/perf/remove-clone

Conversation

@KENILSHAHH
Copy link

Summary

execute_transactions previously called tx.inner.clone().into_inner() on every
transaction to obtain an owned T, solely to take a reference &T from it.
This resulted in a heap allocation and full copy of the transaction data on every
iteration of the hot execution loop, with the allocation being immediately discarded
at the end of each loop body.

The fix replaces this with tx.inner.inner.as_recovered_ref(), which converts
&Recovered<T> to Recovered<&T> in-place by wrapping a pointer to the existing
data.
No allocation or copy is performed.

The T: Clone bound on execute_transactions is also removed, as it existed
solely to support the now-removed clone.

Note: The tracing executor (tracing_executor.rs) already accessed transaction
data without cloning — this change brings execute_transactions in line with that
existing pattern.

@KENILSHAHH KENILSHAHH requested a review from flyq as a code owner March 24, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant