From b10c2b48805c8528ad09a7debcc6cce1e37f406a Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:00:08 +0200 Subject: [PATCH] Improve speed for `Get-CimInstance` This only gets the property we are interested in, instead of computing them all --- lib/parallel.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parallel.rb b/lib/parallel.rb index 82b9ea1..409677b 100644 --- a/lib/parallel.rb +++ b/lib/parallel.rb @@ -357,7 +357,7 @@ def worker_number=(worker_num) def physical_processor_count_windows # Get-CimInstance introduced in PowerShell 3 or earlier: https://learn.microsoft.com/en-us/previous-versions/powershell/module/cimcmdlets/get-ciminstance?view=powershell-3.0 result = run( - 'powershell -command "Get-CimInstance -ClassName Win32_Processor ' \ + 'powershell -command "Get-CimInstance -ClassName Win32_Processor -Property NumberOfCores ' \ '| Select-Object -Property NumberOfCores"' ) if !result || $?.exitstatus != 0