From b8bb0da230934c51bd2f5896e2b00fccce2d69a1 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Mon, 9 Nov 2026 01:37:58 +0100 Subject: [PATCH] feat(compile): Set genact speed factor according to the number of CPU cores MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increase genact speed factor according to the number of CPU (1–10 → 1, 11–20 → 2, 21–30 → 3, etc...) --- src/compile.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/compile.rs b/src/compile.rs index 0bee559..283a14a 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -50,8 +50,8 @@ pub fn compile_process( // Start compilation timer let start = Instant::now(); - // Start genact (if it's installed, directly checked by the start_genact() function) - let mut genact_process = start_genact(); + // Start genact (if it's installed, directly checked by the start_genact function) + let mut genact_process = start_genact(game_state); // Fallback compilation animation if genact is not installed let spinner = ["-", "\\", "|", "/"]; @@ -138,12 +138,17 @@ pub fn compile_process( } // Helper to start genact for compilation animation (if it's installed) -fn start_genact() -> Option { +fn start_genact(game_state: &GameState) -> Option { // Check if genact is installed let genact_path = which("genact").ok()?; + // Calculate speed factor according to the number of CPU cores + let speed_factor = game_state.cpu.div_ceil(10); + // Run genact Command::new(genact_path) + .arg("--speed-factor") + .arg(speed_factor.to_string()) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) .spawn()