1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-30 16:34:36 +01:00

Optimize vector fill in builder. (#89)

* optimize vector fill
This commit is contained in:
zero-systems 2020-01-22 07:35:22 +10:00 committed by Yuki Okushi
parent dbfa13d6be
commit e5b5df1261

View File

@ -263,12 +263,14 @@ 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)
for idx in 0..self.threads { .map(|idx| {
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 {
@ -380,7 +382,7 @@ impl ServerBuilder {
.await; .await;
System::current().stop(); System::current().stop();
} }
.boxed(), .boxed(),
); );
} }
ready(()) ready(())