Skip to content

Commit 535ad4f

Browse files
HoOngEesgkim126
authored andcommitted
Decrease MAX_VERIFIERS
In current structure, multithreading helps little. Because the verification step should be sequential.
1 parent f27f21b commit 535ad4f

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ hyper = { git = "https://github.com/paritytech/hyper", default-features = false
2424
journaldb = { path = "../util/journaldb" }
2525
linked-hash-map = "0.5"
2626
log = "0.4.6"
27-
num_cpus = "1.8"
2827
kvdb = { path = "../util/kvdb" }
2928
kvdb-rocksdb = { path = "../util/kvdb-rocksdb" }
3029
kvdb-memorydb = { path = "../util/kvdb-memorydb" }

core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ extern crate kvdb_memorydb;
3939
extern crate kvdb_rocksdb;
4040
extern crate linked_hash_map;
4141
extern crate memorydb;
42-
extern crate num_cpus;
4342
extern crate num_rational;
4443
extern crate primitives;
4544
extern crate rand;

core/src/verification/queue/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use std::sync::{Arc, Condvar as SCondvar, Mutex as SMutex};
2323
use std::thread::{self, JoinHandle};
2424

2525
use cio::IoChannel;
26-
use num_cpus;
2726
use parking_lot::{Mutex, RwLock};
2827
use primitives::{H256, U256};
2928

@@ -36,8 +35,8 @@ use crate::types::{BlockStatus as Status, VerificationQueueInfo as QueueInfo};
3635
const MIN_MEM_LIMIT: usize = 16384;
3736
const MIN_QUEUE_LIMIT: usize = 512;
3837

39-
// maximum possible number of verification threads.
40-
const MAX_VERIFIERS: usize = 8;
38+
// number of verification threads.
39+
const NUM_VERIFIERS: usize = 2;
4140

4241
/// Type alias for block queue convenience.
4342
pub type BlockQueue = VerificationQueue<kind::Blocks>;
@@ -150,10 +149,9 @@ impl<K: Kind> VerificationQueue<K> {
150149
let empty = Arc::new(SCondvar::new());
151150
let more_to_verify = Arc::new(SCondvar::new());
152151

153-
let num_verifiers = cmp::min(num_cpus::get(), MAX_VERIFIERS);
154-
let mut verifier_handles = Vec::with_capacity(num_verifiers);
152+
let mut verifier_handles = Vec::with_capacity(NUM_VERIFIERS);
155153

156-
for i in 0..num_verifiers {
154+
for i in 0..NUM_VERIFIERS {
157155
let engine = engine.clone();
158156
let verification = verification.clone();
159157
let more_to_verify = more_to_verify.clone();

0 commit comments

Comments
 (0)