Skip to content

Commit 2cd87be

Browse files
committed
Decrease MAX_VERIFIERS
In current structure, multithreading helps little. Because the verification step should be sequential.
1 parent a0ecab5 commit 2cd87be

File tree

1 file changed

+4
-6
lines changed
  • core/src/verification/queue

1 file changed

+4
-6
lines changed

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)