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
Copy Markdown

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
@flyq flyq force-pushed the kenil/perf/remove-clone branch from e284290 to d78e094 Compare April 1, 2026 01:57
Copy link
Copy Markdown
Member

@flyq flyq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebaseed the main branch, and local e2e tests are all normal.
LGTM

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 13.1%. Comparing base (bac6250) to head (d78e094).

Files with missing lines Patch % Lines
crates/stateless-core/src/executor.rs 0.0% 3 Missing ⚠️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants