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

Itertools are no longer reexported from util, optimized triedb iter #6322

Merged
merged 5 commits into from
Aug 21, 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
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dapps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ time = "0.1.35"
unicase = "1.3"
url = "1.0"
zip = { version = "0.1", default-features = false }
itertools = "0.5"

jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
Expand Down
3 changes: 1 addition & 2 deletions dapps/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ pub use self::redirect::Redirection;
pub use self::streaming::StreamingHandler;

use std::iter;
use util::Itertools;

use itertools::Itertools;
use url::Url;
use hyper::{server, header, net, uri};
use {apps, address, Embeddable};
Expand Down
1 change: 1 addition & 0 deletions dapps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
extern crate base32;
extern crate futures;
extern crate futures_cpupool;
extern crate itertools;
extern crate linked_hash_map;
extern crate mime_guess;
extern crate ntp;
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/blockchain/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use std::mem;
use itertools::Itertools;
use bloomchain as bc;
use util::*;
use rlp::*;
Expand Down
3 changes: 2 additions & 1 deletion ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ use std::sync::{Arc, Weak};
use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering};
use std::time::{Instant};
use time::precise_time_ns;
use itertools::Itertools;

// util
use util::{Bytes, PerfTimer, Itertools, Mutex, RwLock, MutexGuard, Hashable};
use util::{Bytes, PerfTimer, Mutex, RwLock, MutexGuard, Hashable};
use util::{journaldb, DBValue, TrieFactory, Trie};
use util::{U256, H256, Address, H2048};
use util::trie::TrieSpec;
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/client/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder};
use std::sync::Arc;
use std::collections::{HashMap, BTreeMap};
use std::mem;
use itertools::Itertools;
use rustc_hex::FromHex;
use util::*;
use rlp::*;
Expand Down
3 changes: 2 additions & 1 deletion ethcore/src/client/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use std::collections::BTreeMap;
use itertools::Itertools;

use block::{OpenBlock, SealedBlock, ClosedBlock};
use blockchain::TreeRoute;
Expand All @@ -33,7 +34,7 @@ use trace::LocalizedTrace;
use transaction::{LocalizedTransaction, PendingTransaction, SignedTransaction};
use verification::queue::QueueInfo as BlockQueueInfo;

use util::{U256, Address, H256, H2048, Bytes, Itertools};
use util::{U256, Address, H256, H2048, Bytes};
use util::hashdb::DBValue;

use types::ids::*;
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/pod_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use std::fmt;
use std::collections::BTreeMap;
use itertools::Itertools;
use util::*;
use state::Account;
use ethjson;
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/pod_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use std::fmt;
use std::collections::BTreeMap;
use itertools::Itertools;
use util::*;
use pod_account::{self, PodAccount};
use types::state_diff::StateDiff;
Expand Down
1 change: 1 addition & 0 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ serde_json = "1.0"
time = "0.1"
tokio-timer = "0.1"
transient-hashmap = "0.4"
itertools = "0.5"

jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
Expand Down
3 changes: 2 additions & 1 deletion rpc/src/authcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ use std::io::{self, Read, Write};
use std::path::Path;
use std::{fs, time, mem};

use itertools::Itertools;
use rand::Rng;
use rand::os::OsRng;
use util::{H256, Hashable, Itertools};
use util::{H256, Hashable};

/// Providing current time in seconds
pub trait TimeProvider {
Expand Down
1 change: 1 addition & 0 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern crate cid;
extern crate crypto as rust_crypto;
extern crate futures;
extern crate futures_cpupool;
extern crate itertools;
extern crate multihash;
extern crate order_stat;
extern crate rand;
Expand Down
1 change: 0 additions & 1 deletion util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ rust-crypto = "0.2.34"
elastic-array = "0.9"
rlp = { path = "rlp" }
heapsize = "0.4"
itertools = "0.5"
sha3 = { path = "sha3" }
clippy = { version = "0.0.103", optional = true}
ethcore-devtools = { path = "../devtools" }
Expand Down
4 changes: 2 additions & 2 deletions util/benches/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ fn random_bytes(min_count: usize, diff_count: usize, seed: &mut H256) -> Vec<u8>
assert!(min_count + diff_count <= 32);
*seed = seed.sha3();
let r = min_count + (seed[31] as usize % (diff_count + 1));
seed[0..r].into_vec()
seed[0..r].to_vec()
}

fn random_value(seed: &mut H256) -> Bytes {
*seed = seed.sha3();
match seed[0] % 2 {
1 => vec![seed[31];1],
_ => seed.into_vec(),
_ => seed.to_vec(),
}
}

Expand Down
5 changes: 3 additions & 2 deletions util/src/journaldb/earlymergedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use std::collections::HashMap;
use std::sync::Arc;
use parking_lot::RwLock;
use heapsize::HeapSizeOf;
use itertools::Itertools;
use rlp::*;
use hashdb::*;
use memorydb::*;
Expand Down Expand Up @@ -432,7 +431,9 @@ impl JournalDB for EarlyMergeDB {
// - we write the key into our journal for this block;

r.begin_list(inserts.len());
inserts.iter().foreach(|&(k, _)| {r.append(&k);});
for &(k, _) in &inserts {
r.append(&k);
}
r.append_list(&removes);
Self::insert_keys(&inserts, &*self.backing, self.column, &mut refs, batch, trace);

Expand Down
2 changes: 0 additions & 2 deletions util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ extern crate rlp;
extern crate regex;
extern crate lru_cache;
extern crate heapsize;
extern crate itertools;
extern crate ethcore_logger;

#[macro_use]
Expand Down Expand Up @@ -153,7 +152,6 @@ pub use bigint::hash;

pub use ansi_term::{Colour, Style};
pub use heapsize::HeapSizeOf;
pub use itertools::Itertools;
pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};

/// 160-bit integer representing account address
Expand Down
11 changes: 9 additions & 2 deletions util/src/trie/triedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use std::fmt;
use itertools::Itertools;
use hashdb::*;
use nibbleslice::*;
use rlp::*;
Expand Down Expand Up @@ -293,7 +292,15 @@ impl<'a> TrieDBIterator<'a> {
/// The present key.
fn key(&self) -> Bytes {
// collapse the key_nibbles down to bytes.
self.key_nibbles.iter().step(2).zip(self.key_nibbles.iter().skip(1).step(2)).map(|(h, l)| h * 16 + l).collect()
let nibbles = &self.key_nibbles;
let mut i = 1;
let mut result = Bytes::with_capacity(nibbles.len() / 2);
let len = nibbles.len();
while i < len {
result.push(nibbles[i - 1] * 16 + nibbles[i]);
i += 2;
}
result
}
}

Expand Down