chore: rm redundant clones - #2325
Open
LesnyRumcajs wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes a few redundant heap allocations/clones across the SDK and FVM implementation, reducing unnecessary copying while preserving behavior.
Changes:
- Avoid cloning return buffers when constructing
IpldBlockresponses in the SDK. - Serialize
piecesdirectly without allocating an intermediateVec<PieceInfo>. - Remove redundant
PathBufcloning and avoidTokenAmountcloning in gas cost computation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/src/lib.rs | Moves the already-owned return buffer into IpldBlock instead of cloning it. |
| sdk/src/crypto.rs | Serializes the pieces slice directly, avoiding an intermediate allocation. |
| fvm/src/kernel/default.rs | Passes &PathBuf to create_dir_all instead of cloning the path. |
| fvm/src/executor/default.rs | Computes gas cost by borrowing gas_fee_cap rather than cloning it. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2325 +/- ##
=======================================
Coverage 77.04% 77.04%
=======================================
Files 143 143
Lines 14203 14203
=======================================
Hits 10943 10943
Misses 3260 3260
🚀 New features to boost your workflow:
|
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.
Got rid of some redundant clones here while I was doing the same in Forest.