mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 04:07:57 +00:00
Improve overall performance (#6699)
* Improve overall performance * Clean up code Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use sp_std::{
|
||||
vec,
|
||||
borrow::Cow, marker::PhantomData, mem, iter::Iterator, result, vec::Vec,
|
||||
};
|
||||
|
||||
@@ -275,8 +276,7 @@ impl PartialEq for dyn Function {
|
||||
pub trait FunctionContext {
|
||||
/// Read memory from `address` into a vector.
|
||||
fn read_memory(&self, address: Pointer<u8>, size: WordSize) -> Result<Vec<u8>> {
|
||||
let mut vec = Vec::with_capacity(size as usize);
|
||||
vec.resize(size as usize, 0);
|
||||
let mut vec = vec![0; size as usize];
|
||||
self.read_memory_into(address, &mut vec)?;
|
||||
Ok(vec)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user