Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Reduce unnecessary allocations #5944

Merged
merged 1 commit into from
Jun 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ethcore/src/engines/tendermint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ impl Engine for Tendermint {
let seal_length = header.seal().len();
if seal_length == self.seal_fields() {
// Either proposal or commit.
if (header.seal()[1] == ::rlp::NULL_RLP.to_vec())
!= (header.seal()[2] == ::rlp::EMPTY_LIST_RLP.to_vec()) {
if (header.seal()[1] == ::rlp::NULL_RLP)
!= (header.seal()[2] == ::rlp::EMPTY_LIST_RLP) {
Ok(())
} else {
warn!(target: "engine", "verify_block_basic: Block is neither a Commit nor Proposal.");
Expand Down
2 changes: 1 addition & 1 deletion util/src/journaldb/archivedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl JournalDB for ArchiveDB {
fn latest_era(&self) -> Option<u64> { self.latest_era }

fn state(&self, id: &H256) -> Option<Bytes> {
self.backing.get_by_prefix(self.column, &id[0..DB_PREFIX_LEN]).map(|b| b.to_vec())
self.backing.get_by_prefix(self.column, &id[0..DB_PREFIX_LEN]).map(|b| b.into_vec())
}

fn is_pruned(&self) -> bool { false }
Expand Down
2 changes: 1 addition & 1 deletion util/src/journaldb/earlymergedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ impl JournalDB for EarlyMergeDB {
}

fn state(&self, id: &H256) -> Option<Bytes> {
self.backing.get_by_prefix(self.column, &id[0..DB_PREFIX_LEN]).map(|b| b.to_vec())
self.backing.get_by_prefix(self.column, &id[0..DB_PREFIX_LEN]).map(|b| b.into_vec())
}

fn journal_under(&mut self, batch: &mut DBTransaction, now: u64, id: &H256) -> Result<u32, UtilError> {
Expand Down
2 changes: 1 addition & 1 deletion util/src/journaldb/overlayrecentdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl JournalDB for OverlayRecentDB {
let key = to_short_key(key);
journal_overlay.backing_overlay.get(&key).map(|v| v.to_vec())
.or_else(|| journal_overlay.pending_overlay.get(&key).map(|d| d.clone().to_vec()))
.or_else(|| self.backing.get_by_prefix(self.column, &key[0..DB_PREFIX_LEN]).map(|b| b.to_vec()))
.or_else(|| self.backing.get_by_prefix(self.column, &key[0..DB_PREFIX_LEN]).map(|b| b.into_vec()))
}

fn journal_under(&mut self, batch: &mut DBTransaction, now: u64, id: &H256) -> Result<u32, UtilError> {
Expand Down
2 changes: 1 addition & 1 deletion util/src/journaldb/refcounteddb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl JournalDB for RefCountedDB {
fn latest_era(&self) -> Option<u64> { self.latest_era }

fn state(&self, id: &H256) -> Option<Bytes> {
self.backing.get_by_prefix(self.column, &id[0..DB_PREFIX_LEN]).map(|b| b.to_vec())
self.backing.get_by_prefix(self.column, &id[0..DB_PREFIX_LEN]).map(|b| b.into_vec())
}

fn journal_under(&mut self, batch: &mut DBTransaction, now: u64, id: &H256) -> Result<u32, UtilError> {
Expand Down