diff options
author | Aaron Hill <aa1ronham@gmail.com> | 2018-03-12 15:34:33 -0400 |
---|---|---|
committer | Aaron Hill <aa1ronham@gmail.com> | 2018-03-12 15:34:33 -0400 |
commit | ca92c4c72e4639a3f91c8467c19ca1863d2743a2 (patch) | |
tree | 058e3af4f9260a5d2454b51af087c4c37b592b1e /src/merkle.rs | |
parent | 31bf8b301f412d9b94f73acf8612c81cc4a2e1a1 (diff) | |
download | roughenough-ca92c4c72e4639a3f91c8467c19ca1863d2743a2.zip |
Remove unecessary flat_map
This gives another ~50,000 reqs/second on my machine
Diffstat (limited to 'src/merkle.rs')
-rw-r--r-- | src/merkle.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/merkle.rs b/src/merkle.rs index 623770f..a93d314 100644 --- a/src/merkle.rs +++ b/src/merkle.rs @@ -36,8 +36,8 @@ impl MerkleTree { self.levels[0].push(hash); } - pub fn get_paths(&self, mut index: usize) -> Vec<Hash> { - let mut paths = Vec::new(); + pub fn get_paths(&self, mut index: usize) -> Vec<u8> { + let mut paths = Vec::with_capacity(self.levels.len() * 64); let mut level = 0; while !self.levels[level].is_empty() { @@ -47,7 +47,7 @@ impl MerkleTree { index - 1 }; - paths.push(self.levels[level][sibling].clone()); + paths.extend(self.levels[level][sibling].clone()); level += 1; index /= 2; } |