rlp serialization refactor (#4873)

* fixed naming of rlp modules

* RlpStream cleanup

* appending short rlp lists (0...55 bytes) is 25% faster

* RlpStream does not use bytes module, nor trait Stream

* removed unused code from rlp module

* compiling ethcore-util with new rlp serialization

* compiling parity with new rlp serialization

* fixed compiling ethcore-light with new rlp serialization

* fixed compiling ethsync with new rlp serialization

* removed redundant comment, print

* removed redundant double-space

* replace usage of WriteBytesExt with ByteOrder
This commit is contained in:
Marek Kotewicz
2017-03-20 19:14:29 +01:00
committed by Gav Wood
parent 16860c3f79
commit a555686bcd
59 changed files with 620 additions and 767 deletions

View File

@@ -427,7 +427,7 @@ impl JournalDB for EarlyMergeDB {
r.begin_list(inserts.len());
inserts.iter().foreach(|&(k, _)| {r.append(&k);});
r.append(&removes);
r.append_list(&removes);
Self::insert_keys(&inserts, &*self.backing, self.column, &mut refs, batch, trace);
let ins = inserts.iter().map(|&(k, _)| k).collect::<Vec<_>>();

View File

@@ -278,7 +278,7 @@ impl JournalDB for OverlayRecentDB {
journal_overlay.backing_overlay.emplace(short_key, v);
}
r.append(&removed_keys);
r.append_list(&removed_keys);
let mut k = RlpStream::new_list(3);
let index = journal_overlay.journal.get(&now).map_or(0, |j| j.len());

View File

@@ -136,8 +136,8 @@ impl JournalDB for RefCountedDB {
let mut r = RlpStream::new_list(3);
r.append(id);
r.append(&self.inserts);
r.append(&self.removes);
r.append_list(&self.inserts);
r.append_list(&self.removes);
batch.put(self.column, &last, r.as_raw());
let ops = self.inserts.len() + self.removes.len();

View File

@@ -17,7 +17,7 @@
//! Diff misc.
use common::*;
use rlp::{Stream, RlpStream};
use rlp::RlpStream;
use target_info::Target;
include!(concat!(env!("OUT_DIR"), "/version.rs"));

View File

@@ -24,7 +24,7 @@ use super::node::NodeKey;
use ::{HashDB, H256};
use ::bytes::ToPretty;
use ::nibbleslice::NibbleSlice;
use ::rlp::{Rlp, RlpStream, View, Stream};
use ::rlp::{Rlp, RlpStream, View};
use ::sha3::SHA3_NULL_RLP;
use hashdb::DBValue;
@@ -931,7 +931,6 @@ impl<'a> Drop for TrieDBMut<'a> {
#[cfg(test)]
mod tests {
use triehash::trie_root;
use hash::*;
use hashdb::*;
use memorydb::*;
use super::*;

View File

@@ -23,7 +23,7 @@ use std::cmp;
use hash::*;
use sha3::*;
use rlp;
use rlp::{RlpStream, Stream};
use rlp::RlpStream;
use vector::SharedPrefix;
/// Generates a trie root hash for a vector of values