-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Misc docs and renames …and one less clone #11556
Conversation
…and one less clone
trace!(target: "sync", "{:02} -> Transactions ({} entries)", peer_id, item_count); | ||
let mut transactions = Vec::with_capacity(item_count); | ||
for i in 0 .. item_count { | ||
let rlp = r.at(i)?; | ||
let rlp = tx_rlp.at(i)?; | ||
let tx = rlp.as_raw().to_vec(); |
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.
I wanted to get rid of this copy here, but I can't make it work.
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.
I don't think it is possible because rlpin::Rlp
is essentially a wrapper over &[u8]
, so one way or another you need to allocate to get Vec<u8>
in safe Rust.
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.
Yeah, my plan was to defer the allocation until we transform the rlp bytes into UnverifiedTransaction
s. But then the transform to UnverifiedTransaction
has to happen outside the ClientIoMessage::Execute
closure. And even then, that closure is an Fn
and changing that to an FnOnce
doesn't work because it can't be called when boxed and at that point I gave up.
Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* master: informant: display I/O stats (#11523) [devp2p discovery]: remove `deprecated_echo_hash` (#11564) [secretstore] create db_version file when database doesn't exist (#11570) Remove Parity's Security Policy (#11565) ethcore/res: enable ecip-1088 phoenix upgrade for kotti and mordor testnets (#11529) Misc docs and renames …and one less clone (#11556) [secretstore]: don't sign message with only zeroes (#11561) [devp2p discovery]: cleanup (#11547) Code cleanup in the sync module (#11552) initial cleanup (#11542) Warn if genesis constructor revert (#11550)
I had a plan for a more extensive refactoring of
ClientMessage::Execute
but it didn't pan out; this here is the random bits and pieces that survived. :(