Class: Benchmark::Runner::Eval
- Inherits:
-
Object
- Object
- Benchmark::Runner::Eval
- Defined in:
- lib/benchmark/runner/eval.rb
Overview
Run benchmark by calling compiled script on running ruby.
Multiple Ruby binaries: x Memory output: x
Defined Under Namespace
Classes: BenchmarkScript
Constant Summary collapse
- SUPPORTED_FIELDS =
This class can provide fields in ‘Benchmark::Driver::BenchmarkResult` if required by output plugins.
[:real]
- WARMUP_DURATION =
2
- BENCHMARK_DURATION =
5
- GUESS_TIMES =
[1, 1_000, 1_000_000, 10_000_000, 100_000_000]
- GUESS_THRESHOLD =
400ms
0.4
Instance Method Summary collapse
-
#initialize(options, output:) ⇒ Eval
constructor
A new instance of Eval.
- #run(config) ⇒ Object
Constructor Details
#initialize(options, output:) ⇒ Eval
Returns a new instance of Eval.
21 22 23 24 |
# File 'lib/benchmark/runner/eval.rb', line 21 def initialize(, output:) @options = @output = output end |
Instance Method Details
#run(config) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/benchmark/runner/eval.rb', line 27 def run(config) validate_config(config) if config.jobs.any?(&:warmup_needed?) run_warmup(config.jobs) end @output.start_running config.jobs.each do |job| @output.running(job.name) result = Benchmark::Driver::RepeatableRunner.new(job).run( runner: method(:eval_times), repeat_count: @options.repeat_count, ) @output.benchmark_stats(result) end @output.finish end |