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,
|
isolation: Mutant::Isolation::Fork,
|
||||||
reporter: Reporter::CLI.build($stdout),
|
reporter: Reporter::CLI.build($stdout),
|
||||||
zombie: false,
|
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
|
expected_coverage: 100.0
|
||||||
)
|
)
|
||||||
end # Config
|
end # Config
|
||||||
|
|
|
@ -112,8 +112,8 @@ module Mutant
|
||||||
opts.on('-r', '--require NAME', 'Require file with NAME') do |name|
|
opts.on('-r', '--require NAME', 'Require file with NAME') do |name|
|
||||||
add(:requires, name)
|
add(:requires, name)
|
||||||
end
|
end
|
||||||
opts.on('-j', '--jobs NUMBER', 'Number of kill processes. Defaults to number of processors.') do |number|
|
opts.on('-j', '--jobs NUMBER', 'Number of kill jobs. Defaults to number of processors.') do |number|
|
||||||
update(processes: Integer(number))
|
update(jobs: Integer(number))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Mutant
|
||||||
:reporter,
|
:reporter,
|
||||||
:isolation,
|
:isolation,
|
||||||
:fail_fast,
|
:fail_fast,
|
||||||
:processes,
|
:jobs,
|
||||||
:zombie,
|
:zombie,
|
||||||
:expected_coverage
|
:expected_coverage
|
||||||
)
|
)
|
||||||
|
|
|
@ -177,7 +177,7 @@ module Mutant
|
||||||
info 'Matcher: %s', object.matcher_config.inspect
|
info 'Matcher: %s', object.matcher_config.inspect
|
||||||
info 'Integration: %s', object.integration.name
|
info 'Integration: %s', object.integration.name
|
||||||
info 'Expect Coverage: %0.2f%%', object.expected_coverage.inspect
|
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 'Includes: %s', object.includes.inspect
|
||||||
info 'Requires: %s', object.requires.inspect
|
info 'Requires: %s', object.requires.inspect
|
||||||
self
|
self
|
||||||
|
|
|
@ -46,9 +46,9 @@ module Mutant
|
||||||
def run
|
def run
|
||||||
Parallel.map(
|
Parallel.map(
|
||||||
@mutations,
|
@mutations,
|
||||||
in_processes: config.processes,
|
in_threads: config.jobs,
|
||||||
finish: method(:finish),
|
finish: method(:finish),
|
||||||
start: method(:start),
|
start: method(:start),
|
||||||
&method(:run_mutation)
|
&method(:run_mutation)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue