rlp deserialization refactor, 30% faster (#4901)
* 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 * moved rlp benches and rlp tests * rlp deserialization refactor, 30% faster * removed redundant comment, print * fixed compiling parity with new rlp deserialization * removed redundant double-space * fixed failing test * updated rlp docs, removed unused traits * fixed rlp benchmarks * replace usage of WriteBytesExt with ByteOrder * removed unused, commented out code * fixed merge conflict
This commit is contained in:
@@ -290,7 +290,7 @@ impl EarlyMergeDB {
|
||||
&r.drain()
|
||||
}).expect("Low-level database error.") {
|
||||
let rlp = Rlp::new(&rlp_data);
|
||||
let inserts: Vec<H256> = rlp.val_at(1);
|
||||
let inserts: Vec<H256> = rlp.list_at(1);
|
||||
Self::replay_keys(&inserts, db, col, &mut refs);
|
||||
index += 1;
|
||||
};
|
||||
@@ -466,11 +466,11 @@ impl JournalDB for EarlyMergeDB {
|
||||
&last
|
||||
})? {
|
||||
let rlp = Rlp::new(&rlp_data);
|
||||
let inserts: Vec<H256> = rlp.val_at(1);
|
||||
let inserts: Vec<H256> = rlp.list_at(1);
|
||||
|
||||
if canon_id == &rlp.val_at::<H256>(0) {
|
||||
// Collect keys to be removed. Canon block - remove the (enacted) deletes.
|
||||
let deletes: Vec<H256> = rlp.val_at(2);
|
||||
let deletes: Vec<H256> = rlp.list_at(2);
|
||||
trace!(target: "jdb.ops", " Expunging: {:?}", deletes);
|
||||
Self::remove_keys(&deletes, &mut refs, batch, self.column, RemoveFrom::Archive, trace);
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ impl OverlayRecentDB {
|
||||
let rlp = Rlp::new(&rlp_data);
|
||||
let id: H256 = rlp.val_at(0);
|
||||
let insertions = rlp.at(1);
|
||||
let deletions: Vec<H256> = rlp.val_at(2);
|
||||
let deletions: Vec<H256> = rlp.list_at(2);
|
||||
let mut inserted_keys = Vec::new();
|
||||
for r in insertions.iter() {
|
||||
let k: H256 = r.val_at(0);
|
||||
|
||||
@@ -171,7 +171,7 @@ impl JournalDB for RefCountedDB {
|
||||
} {
|
||||
let rlp = Rlp::new(&rlp_data);
|
||||
let our_id: H256 = rlp.val_at(0);
|
||||
let to_remove: Vec<H256> = rlp.val_at(if *canon_id == our_id {2} else {1});
|
||||
let to_remove: Vec<H256> = rlp.list_at(if *canon_id == our_id {2} else {1});
|
||||
trace!(target: "rcdb", "delete journal for time #{}.{}=>{}, (canon was {}): deleting {:?}", end_era, index, our_id, canon_id, to_remove);
|
||||
for i in &to_remove {
|
||||
self.forward.remove(i);
|
||||
|
||||
@@ -23,7 +23,7 @@ use std::path::PathBuf;
|
||||
use common::*;
|
||||
use elastic_array::*;
|
||||
use hashdb::DBValue;
|
||||
use rlp::{UntrustedRlp, RlpType, View, Compressible};
|
||||
use rlp::{UntrustedRlp, RlpType, Compressible};
|
||||
use rocksdb::{DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator,
|
||||
Options, DBCompactionStyle, BlockBasedOptions, Direction, Cache, Column, ReadOptions};
|
||||
#[cfg(target_os = "linux")]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use hashdb::HashDB;
|
||||
use nibbleslice::NibbleSlice;
|
||||
use rlp::{Rlp, View};
|
||||
use rlp::Rlp;
|
||||
use ::{H256};
|
||||
|
||||
use super::{TrieError, Query};
|
||||
|
||||
@@ -24,7 +24,7 @@ use super::node::NodeKey;
|
||||
use ::{HashDB, H256};
|
||||
use ::bytes::ToPretty;
|
||||
use ::nibbleslice::NibbleSlice;
|
||||
use ::rlp::{Rlp, RlpStream, View};
|
||||
use ::rlp::{Rlp, RlpStream};
|
||||
use ::sha3::SHA3_NULL_RLP;
|
||||
use hashdb::DBValue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user