Module: Mila::Benchmark::Mixin

Included in:
Mila::Benchmark
Defined in:
lib/mila/benchmark/mixin.rb

Defined Under Namespace

Modules: JS Classes: V8Session

Instance Method Summary collapse

Instance Method Details

#benchmark(label = 'benchmark', &block) ⇒ Object



77
78
79
80
81
82
83
84
85
# File 'lib/mila/benchmark/mixin.rb', line 77

def benchmark(label = 'benchmark', &block)
  param_count = block.arity

  if param_count == 0
    return simple_benchmark(label, &block)
  end

  reporter_benchmark(&block)
end

#ips(time = 5, warmup = 2, quiet = false, &block) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/mila/benchmark/mixin.rb', line 87

def ips(time = 5, warmup = 2, quiet = false, &block)
  puts build_header(block)
  require 'benchmark/ips'
  ::Benchmark.ips(time: time, warmup: warmup, quiet: quiet) do |job|
    proxy = ReporterProxy.new(job)
    block.call(proxy)
    job.compare!
  end
end