benchmark_driver 0.14.3 → 0.14.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 789cf1e0c9ef5f42aa6d5c8239a68ee601f7e8fefb063f3feac921faa7eb4b15
4
- data.tar.gz: 8896c6c8f1983643bc81d70979ed7bce3c872276787d1d6b9f409ae2c27a7b26
3
+ metadata.gz: 75d01094d334aa05e52228bf11f65ff3a3f13178fb367fba125bdb871769dc4d
4
+ data.tar.gz: 68fa671585d87f7a3b06d4e15900cc2b565b9a504e7a6bf6fd63ac310104109c
5
5
  SHA512:
6
- metadata.gz: c3ea314cf74d1ffa3c02904e1de9e9753cdd7f38724b3714b0d1f35a87252eccb6d3b47d2bc12bf60752c6275b5c33ba922194ab63c695637476398dc7698b21
7
- data.tar.gz: 1a0f749bad759c7d8b3c6397ad78ac0f17ba62ef6e7758b4d122b4230b226176c956d17bd4c630d8345cc09ec0b154b8585739fb18a42fdbe4838ef659fd48fe
6
+ metadata.gz: 7147d203e882dccb92446fb901839e5450119c4ee65d38c20e025c1f557cf558ace84e066566a316497c097676d4d2276426befdc87e1021bac6bb19cd2d48d3
7
+ data.tar.gz: c2a431b5c1fa601c0e679125a4c9e5040698f8fb69405270988fbdc1057c6ccb1b350e4164474e5c8197970fff1f6688fff10bd9f3a626b4162747659e7e609d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.14.4
2
+
3
+ - Fix runners and outputs to distinguish 0.0 and ERROR value
4
+
1
5
  # v0.14.3
2
6
 
3
7
  - Support loading runner plugin
@@ -35,7 +35,7 @@ module BenchmarkDriver
35
35
  :environment, # @param [Hash] - Any other key -> value pairs to express the benchmark context
36
36
  defaults: { environment: {} },
37
37
  )
38
- Result::ERROR = 0.0
38
+ Result::ERROR = 0
39
39
 
40
40
  # A kind of thing to be measured
41
41
  Metric = ::BenchmarkDriver::Struct.new(
@@ -116,10 +116,12 @@ class BenchmarkDriver::Output::Compare
116
116
  end
117
117
 
118
118
  def humanize(value, width = 10)
119
- if value == BenchmarkDriver::Result::ERROR
119
+ if BenchmarkDriver::Result::ERROR.equal?(value)
120
120
  return " %#{width}s" % 'ERROR'
121
+ elsif value == 0.0
122
+ return " %#{width}.3f" % 0.0
121
123
  elsif value < 0
122
- raise ArgumentError.new("Non positive value: #{value.inspect}")
124
+ raise ArgumentError.new("Negative value: #{value.inspect}")
123
125
  end
124
126
 
125
127
  scale = (Math.log10(value) / 3).to_i
@@ -82,7 +82,11 @@ class BenchmarkDriver::Output::Markdown
82
82
  end
83
83
 
84
84
  def humanize(value)
85
- if value < 0
85
+ if BenchmarkDriver::Result::ERROR.equal?(value)
86
+ return " %#{NAME_LENGTH}s" % 'ERROR'
87
+ elsif value == 0.0
88
+ return " %#{NAME_LENGTH}.3f" % 0.0
89
+ elsif value < 0
86
90
  raise ArgumentError.new("Negative value: #{value.inspect}")
87
91
  end
88
92
 
@@ -77,8 +77,10 @@ class BenchmarkDriver::Output::Simple
77
77
  end
78
78
 
79
79
  def humanize(value)
80
- if value == BenchmarkDriver::Result::ERROR
81
- return 'ERROR'
80
+ if BenchmarkDriver::Result::ERROR.equal?(value)
81
+ return " %#{NAME_LENGTH}s" % 'ERROR'
82
+ elsif value == 0.0
83
+ return " %#{NAME_LENGTH}.3f" % 0.0
82
84
  elsif value < 0
83
85
  raise ArgumentError.new("Negative value: #{value.inspect}")
84
86
  end
@@ -123,7 +123,7 @@ class BenchmarkDriver::Runner::Ips
123
123
 
124
124
  # Overridden by BenchmarkDriver::Runner::Time
125
125
  def value_duration(duration:, loop_count:)
126
- if duration == BenchmarkDriver::Result::ERROR
126
+ if BenchmarkDriver::Result::ERROR.equal?(duration)
127
127
  [BenchmarkDriver::Result::ERROR, BenchmarkDriver::Result::ERROR]
128
128
  else
129
129
  [loop_count.to_f / duration, duration]
@@ -35,7 +35,7 @@ class BenchmarkDriver::Runner::Once
35
35
  @output.with_job(name: job.name) do
36
36
  job.runnable_contexts(@contexts).each do |context|
37
37
  duration = run_benchmark(job, context: context) # no repeat support
38
- if duration == BenchmarkDriver::Result::ERROR
38
+ if BenchmarkDriver::Result::ERROR.equal?(duration)
39
39
  value = BenchmarkDriver::Result::ERROR
40
40
  else
41
41
  value = 1.0 / duration
@@ -1,3 +1,3 @@
1
1
  module BenchmarkDriver
2
- VERSION = '0.14.3'
2
+ VERSION = '0.14.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun