optimize vector fill

This commit is contained in:
Øsystems 2020-01-21 15:00:19 +10:00
parent dbfa13d6be
commit 6f202ae3b5
1 changed files with 5 additions and 5 deletions

View File

@ -263,12 +263,12 @@ impl ServerBuilder {
info!("Starting {} workers", self.threads); info!("Starting {} workers", self.threads);
// start workers // start workers
let mut workers = Vec::new(); let workers = (0..self.threads).map(|idx| {
for idx in 0..self.threads {
let worker = self.start_worker(idx, self.accept.get_notify()); let worker = self.start_worker(idx, self.accept.get_notify());
workers.push(worker.clone()); self.workers.push((idx, worker.clone()));
self.workers.push((idx, worker));
} worker
}).collect();
// start accept thread // start accept thread
for sock in &self.sockets { for sock in &self.sockets {