perf: remove unnecessary clone in transaction execution loop#103
Closed
KENILSHAHH wants to merge 0 commit intomegaeth-labs:mainfrom
Closed
perf: remove unnecessary clone in transaction execution loop#103KENILSHAHH wants to merge 0 commit intomegaeth-labs:mainfrom
KENILSHAHH wants to merge 0 commit intomegaeth-labs:mainfrom
Conversation
Author
|
adding some more changes through another branch @flyq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
execute_transactionspreviously calledtx.inner.clone().into_inner()on everytransaction to obtain an owned
T, solely to take a reference&Tfrom 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>toRecovered<&T>in-place by wrapping a pointer to the existingdata.
No allocation or copy is performed.
The
T: Clonebound onexecute_transactionsis also removed, as it existedsolely to support the now-removed clone.
Note: The tracing executor (
tracing_executor.rs) already accessed transactiondata without cloning — this change brings
execute_transactionsin line with thatexisting pattern.