Skip to content

Commit

Permalink
Improve speed for Get-CimInstance
Browse files Browse the repository at this point in the history
This only gets the property we are interested in, instead of computing them all
  • Loading branch information
Earlopain committed Jun 8, 2024
1 parent ea82067 commit b10c2b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parallel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b10c2b4

Please sign in to comment.