Skip to content

Commit

Permalink
switch to using processor count instead of physical
Browse files Browse the repository at this point in the history
see grosser/parallel#300
it seems to be faster and it is the same as parallel_tests uses
  • Loading branch information
morganpeterharris committed Aug 28, 2021
1 parent 270accc commit 0bbaddc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
6 changes: 1 addition & 5 deletions lib/parallel_split_test.rb
Expand Up @@ -14,11 +14,7 @@ def choose_number_of_processes
end

def best_number_of_processes
[
ENV['PARALLEL_SPLIT_TEST_PROCESSES'],
Parallel.physical_processor_count,
Parallel.processor_count
].map(&:to_i).find{|number| number > 0 }
Integer(ENV['PARALLEL_SPLIT_TEST_PROCESSES'] || Parallel.processor_count)
end
end
end
8 changes: 1 addition & 7 deletions spec/parallel_split_test_spec.rb
Expand Up @@ -17,13 +17,7 @@
expect(count).to eq(5)
end

it "uses physical_processor_count" do
allow(Parallel).to receive(:physical_processor_count).and_return 6
expect(count).to eq(6)
end

it "uses processor_count if everything else fails" do
allow(Parallel).to receive(:physical_processor_count).and_return 0
it "uses processor_count" do
allow(Parallel).to receive(:processor_count).and_return 7
expect(count).to eq(7)
end
Expand Down

0 comments on commit 0bbaddc

Please sign in to comment.