Use threads for parallelization
* The parallelization runner almost immediately calls a fork and gets blocked on waitpid() releasing the GIL. * Threads have lower resource usage than processes * There is a chance mutant will get faster on smaller machines and might scale better on bigger.
This commit is contained in:
parent
e23784cb25
commit
75c6d73966
5 changed files with 8 additions and 8 deletions
|
@ -221,7 +221,7 @@ module Mutant
|
|||
isolation: Mutant::Isolation::Fork,
|
||||
reporter: Reporter::CLI.build($stdout),
|
||||
zombie: false,
|
||||
processes: Mutant.ci? ? CI_DEFAULT_PROCESSOR_COUNT : Parallel.processor_count,
|
||||
jobs: Mutant.ci? ? CI_DEFAULT_PROCESSOR_COUNT : Parallel.processor_count,
|
||||
expected_coverage: 100.0
|
||||
)
|
||||
end # Config
|
||||
|
|
|
@ -112,8 +112,8 @@ module Mutant
|
|||
opts.on('-r', '--require NAME', 'Require file with NAME') do |name|
|
||||
add(:requires, name)
|
||||
end
|
||||
opts.on('-j', '--jobs NUMBER', 'Number of kill processes. Defaults to number of processors.') do |number|
|
||||
update(processes: Integer(number))
|
||||
opts.on('-j', '--jobs NUMBER', 'Number of kill jobs. Defaults to number of processors.') do |number|
|
||||
update(jobs: Integer(number))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module Mutant
|
|||
:reporter,
|
||||
:isolation,
|
||||
:fail_fast,
|
||||
:processes,
|
||||
:jobs,
|
||||
:zombie,
|
||||
:expected_coverage
|
||||
)
|
||||
|
|
|
@ -177,7 +177,7 @@ module Mutant
|
|||
info 'Matcher: %s', object.matcher_config.inspect
|
||||
info 'Integration: %s', object.integration.name
|
||||
info 'Expect Coverage: %0.2f%%', object.expected_coverage.inspect
|
||||
info 'Processes: %d', object.processes
|
||||
info 'Jobs: %d', object.jobs
|
||||
info 'Includes: %s', object.includes.inspect
|
||||
info 'Requires: %s', object.requires.inspect
|
||||
self
|
||||
|
|
|
@ -46,9 +46,9 @@ module Mutant
|
|||
def run
|
||||
Parallel.map(
|
||||
@mutations,
|
||||
in_processes: config.processes,
|
||||
finish: method(:finish),
|
||||
start: method(:start),
|
||||
in_threads: config.jobs,
|
||||
finish: method(:finish),
|
||||
start: method(:start),
|
||||
&method(:run_mutation)
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue