class Bench::Commands::Compare

Public Instance Methods

before(options, existing_measurements) click to toggle source
# File lib/bench9000/commands/compare.rb, line 14
def before(options, existing_measurements)
  if options.implementations.size < 2
    puts "you need at least two implementations to compare"
    exit
  end
  true
end
benchmark_complete(options, b, measurements) click to toggle source
# File lib/bench9000/commands/compare.rb, line 22
def benchmark_complete(options, b, measurements)
  reference = measurements[b, options.implementations[0]]

  if reference == :failed
    reference_info = "(reference failed) "
  else
    reference_info = ""
  end

  puts "#{b} #{reference_info}" + options.implementations.drop(1).map { |i|
    if reference == :failed
      measurements[b, i].score.to_s
    else
      Stats.format_percent(measurements[b, i].score / reference.score)
    end
  }.join(" ")
end