module BenchmarkInterface::Backends::Simple
Public Class Methods
run(benchmark_set, names, options)
click to toggle source
# File lib/benchmark-interface/backends/simple.rb, line 13 def self.run(benchmark_set, names, options) loop_time = options['--time'] benchmark_set.benchmarks(names).each do |benchmark| puts benchmark.name block = benchmark.block start_time = Time.now while Time.now - start_time < loop_time start_iteration_time = Time.now iterations = 0 while Time.now - start_iteration_time < 1 block.call iterations += 1 end iteration_time = Time.now - start_iteration_time iterations *= benchmark_set.iterations puts iterations / iteration_time end end end