Method: QuickBenchmark#benchmark

Defined in:
lib/quick_benchmark.rb

#benchmark(iterations = 100, &tests) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/quick_benchmark.rb', line 9

def benchmark(iterations = 100, &tests)
  @tests = []
  tests.call
  iterations = QuickBenchmark.iterations_given(iterations)
  Benchmark.bmbm(7) do |x|
    @tests.each do |test|
      x.report(test.label) do
        iterations.times { test.method }
      end
    end
  end
end