diff options
| author | Henrik Tjäder <henrik@tjaders.com> | 2023-02-05 02:07:20 +0100 |
|---|---|---|
| committer | Henrik Tjäder <henrik@tjaders.com> | 2023-03-01 00:35:15 +0100 |
| commit | afba4c7b14f68d589fee2de515075a339689ee95 (patch) | |
| tree | b7a461cce8cb92695680f569522f1ac6dfd03533 /xtask | |
| parent | 50e1d2d129213e286fd4321197d0c9821a034d77 (diff) | |
Improve build time with Rayon
Diffstat (limited to 'xtask')
| -rw-r--r-- | xtask/Cargo.toml | 1 | ||||
| -rw-r--r-- | xtask/src/main.rs | 17 |
2 files changed, 10 insertions, 8 deletions
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index ba0e134..807741a 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -10,3 +10,4 @@ os_pipe = "1.1.2" clap = { version = "4", features = ["derive"] } env_logger = "0.10.0" log = "0.4.17" +rayon = "1.6.1" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 47f3980..01e7934 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -4,6 +4,7 @@ mod command; use anyhow::bail; use clap::{Parser, Subcommand}; use core::fmt; +use rayon::prelude::*; use std::{ error::Error, ffi::OsString, @@ -308,7 +309,7 @@ fn run_test( examples: &[String], overwrite: bool, ) -> anyhow::Result<()> { - for example in examples { + examples.into_par_iter().for_each(|example| { let cmd = CargoCommand::Build { cargoarg: &Some("--quiet"), example, @@ -316,7 +317,7 @@ fn run_test( features: DEFAULT_FEATURES, mode: BuildMode::Release, }; - arm_example(&cmd, false)?; + arm_example(&cmd, false).unwrap(); let cmd = CargoCommand::Run { cargoarg, @@ -326,8 +327,8 @@ fn run_test( mode: BuildMode::Release, }; - arm_example(&cmd, overwrite)?; - } + arm_example(&cmd, overwrite).unwrap(); + }); Ok(()) } @@ -338,7 +339,7 @@ fn build_and_check_size( examples: &[String], size_arguments: &Option<Sizearguments>, ) -> anyhow::Result<()> { - for example in examples { + examples.into_par_iter().for_each(|example| { // Make sure the requested example(s) are built let cmd = CargoCommand::Build { cargoarg: &Some("--quiet"), @@ -347,7 +348,7 @@ fn build_and_check_size( features: DEFAULT_FEATURES, mode: BuildMode::Release, }; - arm_example(&cmd, false)?; + arm_example(&cmd, false).unwrap(); let cmd = CargoCommand::Size { cargoarg, @@ -357,8 +358,8 @@ fn build_and_check_size( mode: BuildMode::Release, arguments: size_arguments.clone(), }; - arm_example(&cmd, false)?; - } + arm_example(&cmd, false).unwrap(); + }); Ok(()) } |
