fix: reduce excess allocations (ENG-2036)#47
Draft
prestwich wants to merge 1 commit intoprestwich/eng-2126-exact-dual-fast-pathfrom
Draft
fix: reduce excess allocations (ENG-2036)#47prestwich wants to merge 1 commit intoprestwich/eng-2126-exact-dual-fast-pathfrom
prestwich wants to merge 1 commit intoprestwich/eng-2126-exact-dual-fast-pathfrom
Conversation
Eliminate unnecessary clones and intermediate collections: - drain_above: zip iterators instead of indexed .get().cloned() - ColdReceipt::new: destructure and into_iter() logs instead of cloning - write_block_to_tx: single-pass loop instead of intermediate Vec - SqlColdBackend::new: match on &str instead of .to_owned() Add ENG-2036 comments for intentionally deferred items (Filter clone, eager into_owned in traversals, format!() SQL queries). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
Author
|
depends on #46 |
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
.get(i).cloned()with.zip()to consume both iterators without cloningVec<ColdReceipt>per blockIndexedReceiptandinto_iter()logs instead of.iter()+.clone()Vec<(tx_hash, sender)>&strdirectly instead of.to_owned()Intentionally deferred (commented with ENG-2036)
Filter::clone()inproduce_log_stream— requires cross-crate trait API change.into_owned()in traverse iterators — requires lifetime refactor of iterator structsformat!()SQL queries — dynamic filter clauses make this unavoidable; mitigated by sqlx prepared-statement cacheTest plan
cargo clippy(all-features + no-default-features) clean for all affected cratescargo tpassing for signet-storage, signet-cold, signet-cold-mdbx, signet-hot, signet-cold-sql🤖 Generated with Claude Code