From 1b5540fdd0ca6b545976db431e9e80c7e3d6e212 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sat, 20 Jun 2026 15:35:43 +0200 Subject: [PATCH] fix: don't request full system info on startup `init_rayon` is calling `System::new_all` which, at least on Linux, parses every single entry in /proc, issuing multiple syscalls per entry. On my system this currently amounts to ~0.5s of overhead on any invocation of `dust`. Use `System::new` since `init_rayon` only needs `refresh_memory`. --- src/main.rs | 2 +- tests/test_exact_output.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index b9c75937..18863f6b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -440,7 +440,7 @@ fn init_rayon(stack: &Option, threads: &Option) -> rayon::ThreadPo None } else { let large_stack = usize::pow(1024, 3); - let mut sys = System::new_all(); + let mut sys = System::new(); sys.refresh_memory(); // Larger stack size if possible to handle cases with lots of nested directories let available = sys.available_memory(); diff --git a/tests/test_exact_output.rs b/tests/test_exact_output.rs index 2d4a4bad..58d2cf9b 100644 --- a/tests/test_exact_output.rs +++ b/tests/test_exact_output.rs @@ -42,7 +42,7 @@ fn create_unreadable_directory() -> io::Result<()> { use std::fs::Permissions; use std::os::unix::fs::PermissionsExt; fs::create_dir_all(UNREADABLE_DIR_PATH)?; - fs::set_permissions(UNREADABLE_DIR_PATH, Permissions::from_mode(0))?; + fs::set_permissions(UNREADABLE_DIR_PATH, Permissions::from_mode(0o0))?; } Ok(()) }