Skip to content

Commit a8e0915

Browse files
authored
Optimize Build::compile_objects on feature parallel (#833)
1 parent d34e43b commit a8e0915

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,15 @@ impl Build {
12601260
fn compile_objects(&self, objs: &[Object], print: &PrintThread) -> Result<(), Error> {
12611261
use std::sync::{mpsc::channel, Once};
12621262

1263+
if objs.len() <= 1 {
1264+
for obj in objs {
1265+
let (mut cmd, name) = self.create_compile_object_cmd(obj)?;
1266+
run(&mut cmd, &name, print)?;
1267+
}
1268+
1269+
return Ok(());
1270+
}
1271+
12631272
// Limit our parallelism globally with a jobserver. Start off by
12641273
// releasing our own token for this process so we can have a bit of an
12651274
// easier to write loop below. If this fails, though, then we're likely

0 commit comments

Comments
 (0)