benchmark-ips 2.8.4 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +8 -2
- data/README.md +8 -4
- data/lib/benchmark/ips.rb +6 -13
- data/lib/benchmark/ips/job.rb +34 -16
- data/lib/benchmark/ips/share.rb +3 -1
- data/test/test_benchmark_ips.rb +22 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bec7b23527f8a5f331788f9de05073eede35e26bbc5a6b81c05a609d964c0ff
|
4
|
+
data.tar.gz: aa8ba81457df018d94262d0eb722870d34406204d02a61b0ad1aa398fa2903ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b8c313bd722fd52229c280d4d566fb9e246b8ae4253a0f508a5b9ca7fffd35cd780cc6c9aa96894733ee87d0df844feae530c10dbf38989cb07367094ce19f3
|
7
|
+
data.tar.gz: 037a07ffd3f129a06a68b5c53617379a9c7e3397fc9b02a961c7e7bb9b566f3ad0b423a43b3b5ed3e40f9edfac4f6eed810bc231c8e6d1398afaa65730d62946
|
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
=== 2.9.0 / 2021-05-21
|
2
|
+
|
3
|
+
* Features
|
4
|
+
* Suite can now be set via an accessor
|
5
|
+
* Default SHARE_URL is now `ips.fastruby.io`, operated by Ombu Labs.
|
6
|
+
|
1
7
|
=== 2.8.4 / 2020-12-03
|
2
8
|
|
3
9
|
* Bug fix
|
@@ -5,12 +11,12 @@
|
|
5
11
|
|
6
12
|
=== 2.8.3 / 2020-08-28
|
7
13
|
|
8
|
-
* Bug fix
|
14
|
+
* Bug fix
|
9
15
|
* Fixed inaccuracy caused by integer overflows.
|
10
16
|
|
11
17
|
=== 2.8.2 / 2020-05-04
|
12
18
|
|
13
|
-
* Bug fix
|
19
|
+
* Bug fix
|
14
20
|
* Fixed problems with Manifest.txt.
|
15
21
|
* Empty interim results files are ignored.
|
16
22
|
|
data/README.md
CHANGED
@@ -186,11 +186,15 @@ end
|
|
186
186
|
|
187
187
|
### Online sharing
|
188
188
|
|
189
|
-
If you want to share
|
190
|
-
with `SHARE=1` argument.
|
191
|
-
|
189
|
+
If you want to quickly share your benchmark result with others, run you benchmark
|
190
|
+
with `SHARE=1` argument. For example: `SHARE=1 ruby my_benchmark.rb`.
|
191
|
+
|
192
|
+
Result will be sent to [benchmark.fyi](https://ips.fastruby.io/) and benchmark-ips
|
192
193
|
will display the link to share the benchmark's result.
|
193
194
|
|
195
|
+
If you want to run your own instance of [benchmark.fyi](https://github.com/evanphx/benchmark.fyi)
|
196
|
+
and share it to that instance, you can do this: `SHARE_URL=https://ips.example.com ruby my_benchmark.rb`
|
197
|
+
|
194
198
|
### Advanced Statistics
|
195
199
|
|
196
200
|
By default, the margin of error shown is plus-minus one standard deviation. If
|
@@ -227,7 +231,7 @@ Benchmark.ips do |x|
|
|
227
231
|
|
228
232
|
x.stats = :bootstrap
|
229
233
|
x.confidence = 95
|
230
|
-
|
234
|
+
|
231
235
|
# confidence is 95% by default, so it can be omitted
|
232
236
|
|
233
237
|
end
|
data/lib/benchmark/ips.rb
CHANGED
@@ -5,8 +5,10 @@ require 'benchmark/ips/stats/stats_metric'
|
|
5
5
|
require 'benchmark/ips/stats/sd'
|
6
6
|
require 'benchmark/ips/stats/bootstrap'
|
7
7
|
require 'benchmark/ips/report'
|
8
|
+
require 'benchmark/ips/noop_suite'
|
8
9
|
require 'benchmark/ips/job/entry'
|
9
10
|
require 'benchmark/ips/job/stdout_report'
|
11
|
+
require 'benchmark/ips/job/noop_report'
|
10
12
|
require 'benchmark/ips/job'
|
11
13
|
|
12
14
|
# Performance benchmarking library
|
@@ -16,10 +18,10 @@ module Benchmark
|
|
16
18
|
module IPS
|
17
19
|
|
18
20
|
# Benchmark-ips Gem version.
|
19
|
-
VERSION = "2.
|
21
|
+
VERSION = "2.9.0"
|
20
22
|
|
21
23
|
# CODENAME of current version.
|
22
|
-
CODENAME = "
|
24
|
+
CODENAME = "Sleepy Sasquatch"
|
23
25
|
|
24
26
|
# Measure code in block, each code's benchmarked result will display in
|
25
27
|
# iteration per second with standard deviation in given time.
|
@@ -33,23 +35,14 @@ module Benchmark
|
|
33
35
|
time, warmup, quiet = args
|
34
36
|
end
|
35
37
|
|
36
|
-
suite = nil
|
37
|
-
|
38
38
|
sync, $stdout.sync = $stdout.sync, true
|
39
39
|
|
40
|
-
|
41
|
-
suite = Benchmark::Suite.current
|
42
|
-
end
|
43
|
-
|
44
|
-
quiet ||= (suite && suite.quiet?)
|
45
|
-
|
46
|
-
job = Job.new({:suite => suite,
|
47
|
-
:quiet => quiet
|
48
|
-
})
|
40
|
+
job = Job.new
|
49
41
|
|
50
42
|
job_opts = {}
|
51
43
|
job_opts[:time] = time unless time.nil?
|
52
44
|
job_opts[:warmup] = warmup unless warmup.nil?
|
45
|
+
job_opts[:quiet] = quiet unless quiet.nil?
|
53
46
|
|
54
47
|
job.config job_opts
|
55
48
|
|
data/lib/benchmark/ips/job.rb
CHANGED
@@ -51,16 +51,20 @@ module Benchmark
|
|
51
51
|
# @return [Integer]
|
52
52
|
attr_accessor :confidence
|
53
53
|
|
54
|
+
# Silence output
|
55
|
+
# @return [Boolean]
|
56
|
+
attr_reader :quiet
|
57
|
+
|
58
|
+
# Suite
|
59
|
+
# @return [Benchmark::IPS::NoopSuite]
|
60
|
+
attr_reader :suite
|
61
|
+
|
54
62
|
# Instantiate the Benchmark::IPS::Job.
|
55
|
-
# @option opts [Benchmark::Suite] (nil) :suite Specify Benchmark::Suite.
|
56
|
-
# @option opts [Boolean] (false) :quiet Suppress the printing of information.
|
57
63
|
def initialize opts={}
|
58
|
-
@suite = opts[:suite] || nil
|
59
|
-
@stdout = opts[:quiet] ? nil : StdoutReport.new
|
60
64
|
@list = []
|
61
|
-
@compare = false
|
62
65
|
@run_single = false
|
63
66
|
@json_path = false
|
67
|
+
@compare = false
|
64
68
|
@held_path = nil
|
65
69
|
@held_results = nil
|
66
70
|
|
@@ -88,6 +92,20 @@ module Benchmark
|
|
88
92
|
@iterations = opts[:iterations] if opts[:iterations]
|
89
93
|
@stats = opts[:stats] if opts[:stats]
|
90
94
|
@confidence = opts[:confidence] if opts[:confidence]
|
95
|
+
self.quiet = opts[:quiet]
|
96
|
+
self.suite = opts[:suite]
|
97
|
+
end
|
98
|
+
|
99
|
+
def quiet=(val)
|
100
|
+
@stdout = reporter(quiet: val)
|
101
|
+
end
|
102
|
+
|
103
|
+
def suite=(suite)
|
104
|
+
@suite = suite || Benchmark::IPS::NoopSuite.new
|
105
|
+
end
|
106
|
+
|
107
|
+
def reporter(quiet:)
|
108
|
+
quiet ? NoopReport.new : StdoutReport.new
|
91
109
|
end
|
92
110
|
|
93
111
|
# Return true if job needs to be compared.
|
@@ -223,19 +241,19 @@ module Benchmark
|
|
223
241
|
|
224
242
|
def run
|
225
243
|
if @warmup && @warmup != 0 then
|
226
|
-
@stdout.start_warming
|
244
|
+
@stdout.start_warming
|
227
245
|
@iterations.times do
|
228
246
|
run_warmup
|
229
247
|
end
|
230
248
|
end
|
231
249
|
|
232
|
-
@stdout.start_running
|
250
|
+
@stdout.start_running
|
233
251
|
|
234
252
|
@iterations.times do |n|
|
235
253
|
run_benchmark
|
236
254
|
end
|
237
255
|
|
238
|
-
@stdout.footer
|
256
|
+
@stdout.footer
|
239
257
|
end
|
240
258
|
|
241
259
|
# Run warmup.
|
@@ -243,8 +261,8 @@ module Benchmark
|
|
243
261
|
@list.each do |item|
|
244
262
|
next if run_single? && @held_results && @held_results.key?(item.label)
|
245
263
|
|
246
|
-
@suite.warming item.label, @warmup
|
247
|
-
@stdout.warming item.label, @warmup
|
264
|
+
@suite.warming item.label, @warmup
|
265
|
+
@stdout.warming item.label, @warmup
|
248
266
|
|
249
267
|
Timing.clean_env
|
250
268
|
|
@@ -280,8 +298,8 @@ module Benchmark
|
|
280
298
|
item.call_times cycles
|
281
299
|
end
|
282
300
|
|
283
|
-
@stdout.warmup_stats warmup_time_us, @timing[item]
|
284
|
-
@suite.warmup_stats warmup_time_us, @timing[item]
|
301
|
+
@stdout.warmup_stats warmup_time_us, @timing[item]
|
302
|
+
@suite.warmup_stats warmup_time_us, @timing[item]
|
285
303
|
|
286
304
|
break if run_single?
|
287
305
|
end
|
@@ -292,8 +310,8 @@ module Benchmark
|
|
292
310
|
@list.each do |item|
|
293
311
|
next if run_single? && @held_results && @held_results.key?(item.label)
|
294
312
|
|
295
|
-
@suite.running item.label, @time
|
296
|
-
@stdout.running item.label, @time
|
313
|
+
@suite.running item.label, @time
|
314
|
+
@stdout.running item.label, @time
|
297
315
|
|
298
316
|
Timing.clean_env
|
299
317
|
|
@@ -334,8 +352,8 @@ module Benchmark
|
|
334
352
|
rep.show_total_time!
|
335
353
|
end
|
336
354
|
|
337
|
-
@stdout.add_report rep, caller(1).first
|
338
|
-
@suite.add_report rep, caller(1).first
|
355
|
+
@stdout.add_report rep, caller(1).first
|
356
|
+
@suite.add_report rep, caller(1).first
|
339
357
|
|
340
358
|
break if run_single?
|
341
359
|
end
|
data/lib/benchmark/ips/share.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'net/http'
|
2
4
|
require 'net/https'
|
3
5
|
require 'json'
|
@@ -5,7 +7,7 @@ require 'json'
|
|
5
7
|
module Benchmark
|
6
8
|
module IPS
|
7
9
|
class Share
|
8
|
-
DEFAULT_URL = "https://
|
10
|
+
DEFAULT_URL = "https://ips.fastruby.io"
|
9
11
|
def initialize(report, job)
|
10
12
|
@report = report
|
11
13
|
@job = job
|
data/test/test_benchmark_ips.rb
CHANGED
@@ -54,6 +54,13 @@ class TestBenchmarkIPS < Minitest::Test
|
|
54
54
|
end
|
55
55
|
|
56
56
|
assert $stdout.string.size.zero?
|
57
|
+
|
58
|
+
Benchmark.ips do |x|
|
59
|
+
x.quiet = true
|
60
|
+
x.report("operation") { 100 * 100 }
|
61
|
+
end
|
62
|
+
|
63
|
+
assert $stdout.string.size.zero?
|
57
64
|
end
|
58
65
|
|
59
66
|
def test_ips
|
@@ -117,6 +124,21 @@ class TestBenchmarkIPS < Minitest::Test
|
|
117
124
|
assert_equal [:warming, :warmup_stats, :running, :add_report], suite.calls
|
118
125
|
end
|
119
126
|
|
127
|
+
def test_ips_config_suite_by_accsr
|
128
|
+
suite = Struct.new(:calls) do
|
129
|
+
def method_missing(method, *args)
|
130
|
+
calls << method
|
131
|
+
end
|
132
|
+
end.new([])
|
133
|
+
|
134
|
+
Benchmark.ips(0.1, 0.1) do |x|
|
135
|
+
x.suite = suite
|
136
|
+
x.report("job") {}
|
137
|
+
end
|
138
|
+
|
139
|
+
assert_equal [:warming, :warmup_stats, :running, :add_report], suite.calls
|
140
|
+
end
|
141
|
+
|
120
142
|
def test_ips_defaults
|
121
143
|
report = Benchmark.ips do |x|
|
122
144
|
x.report("sleep 0.25") { sleep(0.25) }
|
metadata
CHANGED
@@ -1,31 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark-ips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: minitest
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '5.14'
|
20
|
-
|
19
|
+
name: minitest
|
21
20
|
prerelease: false
|
21
|
+
type: :development
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: rdoc
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
@@ -34,8 +33,9 @@ dependencies:
|
|
34
33
|
- - "<"
|
35
34
|
- !ruby/object:Gem::Version
|
36
35
|
version: '7'
|
37
|
-
|
36
|
+
name: rdoc
|
38
37
|
prerelease: false
|
38
|
+
type: :development
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '7'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: hoe
|
49
48
|
requirement: !ruby/object:Gem::Requirement
|
50
49
|
requirements:
|
51
50
|
- - "~>"
|
52
51
|
- !ruby/object:Gem::Version
|
53
52
|
version: '3.22'
|
54
|
-
|
53
|
+
name: hoe
|
55
54
|
prerelease: false
|
55
|
+
type: :development
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
rubygems_version: 3.1.
|
110
|
+
rubygems_version: 3.1.6
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: An iterations per second enhancement to Benchmark.
|