mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
Improve build time with Rayon
This commit is contained in:
parent
50e1d2d129
commit
afba4c7b14
2 changed files with 10 additions and 8 deletions
|
@ -10,3 +10,4 @@ os_pipe = "1.1.2"
|
||||||
clap = { version = "4", features = ["derive"] }
|
clap = { version = "4", features = ["derive"] }
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
|
rayon = "1.6.1"
|
||||||
|
|
|
@ -4,6 +4,7 @@ mod command;
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
use rayon::prelude::*;
|
||||||
use std::{
|
use std::{
|
||||||
error::Error,
|
error::Error,
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
|
@ -308,7 +309,7 @@ fn run_test(
|
||||||
examples: &[String],
|
examples: &[String],
|
||||||
overwrite: bool,
|
overwrite: bool,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
for example in examples {
|
examples.into_par_iter().for_each(|example| {
|
||||||
let cmd = CargoCommand::Build {
|
let cmd = CargoCommand::Build {
|
||||||
cargoarg: &Some("--quiet"),
|
cargoarg: &Some("--quiet"),
|
||||||
example,
|
example,
|
||||||
|
@ -316,7 +317,7 @@ fn run_test(
|
||||||
features: DEFAULT_FEATURES,
|
features: DEFAULT_FEATURES,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
};
|
};
|
||||||
arm_example(&cmd, false)?;
|
arm_example(&cmd, false).unwrap();
|
||||||
|
|
||||||
let cmd = CargoCommand::Run {
|
let cmd = CargoCommand::Run {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -326,8 +327,8 @@ fn run_test(
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
};
|
};
|
||||||
|
|
||||||
arm_example(&cmd, overwrite)?;
|
arm_example(&cmd, overwrite).unwrap();
|
||||||
}
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -338,7 +339,7 @@ fn build_and_check_size(
|
||||||
examples: &[String],
|
examples: &[String],
|
||||||
size_arguments: &Option<Sizearguments>,
|
size_arguments: &Option<Sizearguments>,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
for example in examples {
|
examples.into_par_iter().for_each(|example| {
|
||||||
// Make sure the requested example(s) are built
|
// Make sure the requested example(s) are built
|
||||||
let cmd = CargoCommand::Build {
|
let cmd = CargoCommand::Build {
|
||||||
cargoarg: &Some("--quiet"),
|
cargoarg: &Some("--quiet"),
|
||||||
|
@ -347,7 +348,7 @@ fn build_and_check_size(
|
||||||
features: DEFAULT_FEATURES,
|
features: DEFAULT_FEATURES,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
};
|
};
|
||||||
arm_example(&cmd, false)?;
|
arm_example(&cmd, false).unwrap();
|
||||||
|
|
||||||
let cmd = CargoCommand::Size {
|
let cmd = CargoCommand::Size {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
|
@ -357,8 +358,8 @@ fn build_and_check_size(
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
arguments: size_arguments.clone(),
|
arguments: size_arguments.clone(),
|
||||||
};
|
};
|
||||||
arm_example(&cmd, false)?;
|
arm_example(&cmd, false).unwrap();
|
||||||
}
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue