microoptimization
This commit is contained in:
parent
5ba8f528ba
commit
9b080c9161
@ -844,8 +844,12 @@ impl RlpStream {
|
|||||||
// we may finish, if the appended list len is equal 0
|
// we may finish, if the appended list len is equal 0
|
||||||
self.encoder.bytes.push(0xc0u8);
|
self.encoder.bytes.push(0xc0u8);
|
||||||
self.note_appended(1);
|
self.note_appended(1);
|
||||||
}
|
},
|
||||||
_ => self.unfinished_lists.push_back(ListInfo::new(position, len)),
|
_ => {
|
||||||
|
// reserve at least double size of the len
|
||||||
|
self.encoder.bytes.reserve(len * 2);
|
||||||
|
self.unfinished_lists.push_back(ListInfo::new(position, len));
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// return chainable self
|
// return chainable self
|
||||||
|
Loading…
Reference in New Issue
Block a user