benchmark-http 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ff28ada0eec1dced43b0381dcd1c81130a6ec6f6225f8680e1ea0178bc735f0
4
- data.tar.gz: a56465b61af11a0ea0caf2bd072af4aca74ec1dd0dd74cbb516c0d7d1f237eec
3
+ metadata.gz: 1a12b67daeeadc34944c967a8f441da017cb3a31f3bb778893b344b3b24115d1
4
+ data.tar.gz: efff4138d8be9145ab9df016162bce6bbf2da9e4fcfd36cebda36acc9601a773
5
5
  SHA512:
6
- metadata.gz: f329c0b4ee5250a6a67b278b1083502e78cf615fa000ba1ead3067ced2c41291b856196f069216db0d92ab2e38b20ec3116a361da1fbae52840bf25ba99b7a80
7
- data.tar.gz: 8af88a24ef3e4815046f15fb292f925b78e8d55f7c78259bac460fa34837a105d9a9e96625d64563be938d8f34f84e11180df5d76262b64f54e414a875da04d7
6
+ metadata.gz: dd41f22b3e11709045bb9e63ab41a9069f9548c243ef1ab365e045eaf7f548ff0b88d03060404404e68c2484cfbc0dbfa4b2101f11764c5f70f0ad9a5197e110
7
+ data.tar.gz: 59cce9e283b1ed06e49d34c7159ff2b883455b474b057c9b1c932427bb31e9b8421224288b1c9d5269da4da10271d922697a645c8df319393fa61c2204ba1bc3
@@ -64,7 +64,7 @@ module Benchmark
64
64
  end
65
65
  end.each(&:wait)
66
66
 
67
- puts "I made #{statistics.count} requests in #{Seconds[statistics.sequential_duration]}. The per-request latency was #{Seconds[statistics.latency]}. That's #{statistics.per_second.round(2)} asynchronous requests/second."
67
+ puts "I made #{statistics.size} requests in #{Seconds[statistics.sequential_duration]}. The per-request latency was #{Seconds[statistics.latency]}. That's #{statistics.per_second.round(2)} asynchronous requests/second."
68
68
 
69
69
  puts "\t Variance: #{Seconds[statistics.variance]}"
70
70
  puts "\tStandard Deviation: #{Seconds[statistics.standard_deviation]}"
@@ -70,6 +70,8 @@ module Benchmark
70
70
  end
71
71
 
72
72
  filter.links.collect do |href|
73
+ next if href.nil? or href.empty?
74
+
73
75
  begin
74
76
  full_url = base + href
75
77
 
@@ -22,7 +22,7 @@ module Benchmark
22
22
  module HTTP
23
23
  class Seconds
24
24
  UNITS = ["s", "ms", "µs"]
25
- SCALE = UNITS.count - 1
25
+ SCALE = UNITS.size - 1
26
26
 
27
27
  def self.[](value)
28
28
  self.new(value)
@@ -48,11 +48,11 @@ module Benchmark
48
48
  end
49
49
 
50
50
  def count
51
- @samples.count
51
+ @samples.size
52
52
  end
53
53
 
54
54
  def per_second(duration = self.sequential_duration)
55
- @samples.count.to_f / duration.to_f
55
+ @samples.size.to_f / duration.to_f
56
56
  end
57
57
 
58
58
  def latency
@@ -67,12 +67,12 @@ module Benchmark
67
67
 
68
68
  def average
69
69
  if @samples.any?
70
- @samples.sum / @samples.count
70
+ @samples.sum / @samples.size
71
71
  end
72
72
  end
73
73
 
74
74
  def valid?
75
- @samples.count > 1
75
+ @samples.size > 1
76
76
  end
77
77
 
78
78
  # Computes Population Variance, σ^2.
@@ -80,7 +80,7 @@ module Benchmark
80
80
  if valid?
81
81
  average = self.average
82
82
 
83
- return @samples.map{|n| (n - average)**2}.sum / @samples.count
83
+ return @samples.map{|n| (n - average)**2}.sum / @samples.size
84
84
  end
85
85
  end
86
86
 
@@ -93,7 +93,7 @@ module Benchmark
93
93
 
94
94
  def standard_error
95
95
  if standard_deviation = self.standard_deviation
96
- standard_deviation / Math.sqrt(@samples.count)
96
+ standard_deviation / Math.sqrt(@samples.size)
97
97
  end
98
98
  end
99
99
 
@@ -135,7 +135,7 @@ module Benchmark
135
135
 
136
136
  def print(out = STDOUT)
137
137
  if self.valid?
138
- out.puts "#{@samples.count} samples. #{per_second} requests per second. S/D: #{Seconds[standard_deviation]}."
138
+ out.puts "#{@samples.size} samples. #{per_second} requests per second. S/D: #{Seconds[standard_deviation]}."
139
139
  else
140
140
  out.puts "Not enough samples."
141
141
  end
@@ -144,7 +144,7 @@ module Benchmark
144
144
  private
145
145
 
146
146
  def confident?(factor)
147
- if @samples.count > @concurrency
147
+ if @samples.size > @concurrency
148
148
  return self.standard_error < (self.average * factor)
149
149
  end
150
150
 
@@ -170,7 +170,7 @@ module Benchmark
170
170
  if valid?
171
171
  counts = @responses.sort.collect{|status, count| "#{count}x #{status}"}.join("; ")
172
172
 
173
- out.puts "#{@samples.count} samples: #{counts}. #{per_second.round(2)} requests per second. S/D: #{Seconds[standard_deviation]}."
173
+ out.puts "#{@samples.size} samples: #{counts}. #{per_second.round(2)} requests per second. S/D: #{Seconds[standard_deviation]}."
174
174
  else
175
175
  out.puts "Not enough samples."
176
176
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Benchmark
22
22
  module HTTP
23
- VERSION = "0.8.1"
23
+ VERSION = "0.8.2"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-io
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 3.0.3
168
+ rubygems_version: 3.0.6
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: An asynchronous benchmark toolbox for modern HTTP servers.