Class: Bench::Commands::Compare
- Defined in:
- lib/bench9000/commands/compare.rb
Instance Method Summary collapse
- #before(options, existing_measurements) ⇒ Object
- #benchmark_complete(options, b, measurements) ⇒ Object
Methods inherited from Command
Instance Method Details
#before(options, existing_measurements) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/bench9000/commands/compare.rb', line 14 def before(, existing_measurements) if .implementations.size < 2 puts "you need at least two implementations to compare" exit end true end |
#benchmark_complete(options, b, measurements) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bench9000/commands/compare.rb', line 22 def benchmark_complete(, b, measurements) reference = measurements[b, .implementations[0]] if reference == :failed reference_info = "(reference failed) " else reference_info = "" end puts "#{b} #{reference_info}" + .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 |