Skip to content

Commit

Permalink
Optimize Build::compile_objects on feature parallel (#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
NobodyXu committed Jul 21, 2023
1 parent d34e43b commit a8e0915
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,15 @@ impl Build {
fn compile_objects(&self, objs: &[Object], print: &PrintThread) -> Result<(), Error> {
use std::sync::{mpsc::channel, Once};

if objs.len() <= 1 {
for obj in objs {
let (mut cmd, name) = self.create_compile_object_cmd(obj)?;
run(&mut cmd, &name, print)?;
}

return Ok(());
}

// Limit our parallelism globally with a jobserver. Start off by
// releasing our own token for this process so we can have a bit of an
// easier to write loop below. If this fails, though, then we're likely
Expand Down

0 comments on commit a8e0915

Please sign in to comment.