Skip to content

Commit 65087c8

Browse files
Use logical core count for test parallelization
This changes the default number of workers when parallelizing tests to be based on logical core count instead of physical core count. This may provide a performance boost for parallelized tests. This also reverts rails#50545 in favor of using the default worker count.
1 parent 0d940e3 commit 65087c8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

activesupport/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* Use logical core count instead of physical core count to determine the
2+
default number of workers when parallelizing tests.
3+
4+
*Jonathan Hefner*
5+
16
* Fix `Time.now/DateTime.now/Date.today' to return results in a system timezone after `#travel_to'.
27

38
There is a bug in the current implementation of #travel_to:

activesupport/lib/active_support/test_case.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_order
7878
# number of tests to run is above the +threshold+ param. The default value is
7979
# 50, and it's configurable via +config.active_support.test_parallelization_threshold+.
8080
def parallelize(workers: :number_of_processors, with: :processes, threshold: ActiveSupport.test_parallelization_threshold)
81-
workers = Concurrent.physical_processor_count if workers == :number_of_processors
81+
workers = Concurrent.processor_count if workers == :number_of_processors
8282
workers = ENV["PARALLEL_WORKERS"].to_i if ENV["PARALLEL_WORKERS"]
8383

8484
Minitest.parallel_executor = ActiveSupport::Testing::ParallelizeExecutor.new(size: workers, with: with, threshold: threshold)

railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ jobs:
110110
ruby-version: .ruby-version
111111
bundler-cache: true
112112

113-
- name: Configure parallelization
114-
run: echo "PARALLEL_WORKERS=$(nproc)" >> $GITHUB_ENV
115-
116113
- name: Run tests
117114
env:
118115
RAILS_ENV: test

0 commit comments

Comments
 (0)