-
Notifications
You must be signed in to change notification settings - Fork 152
chore: optimize allocation in get_pooled_transaction_elements by pre‑allocating capacity #1766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@0xKarl98 is attempting to deploy a commit to the Tempo Team on Vercel. A member of the Team first needs to authorize it. |
| .map(|tx| tx.into_inner()) | ||
| }) | ||
| .collect::<Vec<_>>(); | ||
| let mut txs = Vec::with_capacity(tx_hashes.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could over allocate
| for tx in self.aa_2d_pool.read().get_all_iter(&tx_hashes) { | ||
| // Safe unwrap: TryFromConsensusError is Infallible for TempoPooledTransaction. | ||
| let pooled = tx.transaction.clone_into_pooled().unwrap(); | ||
| txs.push(pooled.into_inner()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of this we could simple flip it and first obtain a vec from
self.protocol_pool
.get_pooled_transaction_elements
and then extend that
if you want you can also submit a pr that adds fn append_pooled_transaction_elements variant for this:
similar to
|
pending @mattsse |
This aims at resolve issue #1764
cc @mattsse