Skip to content

Commit

Permalink
+ Use Etc.nprocessors by default in order to maximize cpu usage. (ton…
Browse files Browse the repository at this point in the history
…ytonyjan)

[git-p4: depot-paths = "//src/minitest/dev/": change = 13277]
  • Loading branch information
zenspider committed Dec 5, 2021
1 parent 5352c9e commit a320274
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/minitest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "mutex_m"
require "minitest/parallel"
require "stringio"
require "etc"

##
# :include: README.rdoc
Expand All @@ -23,7 +24,7 @@ module Minitest
mc.send :attr_accessor, :parallel_executor

warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"]
n_threads = (ENV["MT_CPU"] || ENV["N"] || 2).to_i
n_threads = (ENV["MT_CPU"] || ENV["N"] || Etc.nprocessors).to_i
self.parallel_executor = Parallel::Executor.new n_threads

##
Expand Down

0 comments on commit a320274

Please sign in to comment.