From: Alex Crichton Date: Fri, 2 Jun 2017 16:15:11 +0000 (-0700) Subject: Don't spawn threads for fresh work X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~9^2~8^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0af2914bd923dbd3478df13954a274a0414ab1a8;p=cargo.git Don't spawn threads for fresh work On "fresh" builds this ends up just wasting a lot of time! --- diff --git a/src/cargo/ops/cargo_rustc/job_queue.rs b/src/cargo/ops/cargo_rustc/job_queue.rs index 7bb3e35e1..fa008289d 100644 --- a/src/cargo/ops/cargo_rustc/job_queue.rs +++ b/src/cargo/ops/cargo_rustc/job_queue.rs @@ -294,12 +294,16 @@ impl<'a> JobQueue<'a> { *self.counts.get_mut(key.pkg).unwrap() -= 1; let my_tx = self.tx.clone(); - scope.spawn(move || { + let doit = move || { let res = job.run(fresh, &JobState { tx: my_tx.clone(), }); my_tx.send(Message::Finish(key, res)).unwrap(); - }); + }; + match fresh { + Freshness::Fresh => doit(), + Freshness::Dirty => { scope.spawn(doit); } + } // Print out some nice progress information self.note_working_on(config, &key, fresh)?;