benchmark-ips 2.8.4 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +13 -2
- data/Manifest.txt +2 -0
- data/README.md +8 -4
- data/lib/benchmark/ips/job/noop_report.rb +27 -0
- data/lib/benchmark/ips/job.rb +34 -16
- data/lib/benchmark/ips/noop_suite.rb +25 -0
- data/lib/benchmark/ips/share.rb +3 -1
- data/lib/benchmark/ips.rb +6 -13
- data/test/test_benchmark_ips.rb +22 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6c664c1e49fd7235ba573dc4a5bd92ce7446c0d4206c355a2c7b84320b26d5a
|
4
|
+
data.tar.gz: 72d1502418ff11b5e321825ad5d3d1c44889d170c7da0becbf8b6b9fd7c5f283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0956333ead3cb5307864b8d013828fff4f8dbec88c27142314d2742ba5378dbf0388f04706bf797cb24d2fd21a38576cdf04892d62664eb418d6cba38e5bfb33'
|
7
|
+
data.tar.gz: 0a953ca0e9270f4eac9c00c51117bc2bfcba6a06e51f3508152b3dcbfd8e03ae4e0cebbf79bc6dc51efcf200e459d9a5ee457d70f371f946e1da8a75c50f7462
|
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 2.9.1 / 2021-05-24
|
2
|
+
|
3
|
+
* Bug fix
|
4
|
+
* Include all files in gem
|
5
|
+
|
6
|
+
=== 2.9.0 / 2021-05-21
|
7
|
+
|
8
|
+
* Features
|
9
|
+
* Suite can now be set via an accessor
|
10
|
+
* Default SHARE_URL is now `ips.fastruby.io`, operated by Ombu Labs.
|
11
|
+
|
1
12
|
=== 2.8.4 / 2020-12-03
|
2
13
|
|
3
14
|
* Bug fix
|
@@ -5,12 +16,12 @@
|
|
5
16
|
|
6
17
|
=== 2.8.3 / 2020-08-28
|
7
18
|
|
8
|
-
* Bug fix
|
19
|
+
* Bug fix
|
9
20
|
* Fixed inaccuracy caused by integer overflows.
|
10
21
|
|
11
22
|
=== 2.8.2 / 2020-05-04
|
12
23
|
|
13
|
-
* Bug fix
|
24
|
+
* Bug fix
|
14
25
|
* Fixed problems with Manifest.txt.
|
15
26
|
* Empty interim results files are ignored.
|
16
27
|
|
data/Manifest.txt
CHANGED
@@ -7,7 +7,9 @@ lib/benchmark/compare.rb
|
|
7
7
|
lib/benchmark/ips.rb
|
8
8
|
lib/benchmark/ips/job.rb
|
9
9
|
lib/benchmark/ips/job/entry.rb
|
10
|
+
lib/benchmark/ips/job/noop_report.rb
|
10
11
|
lib/benchmark/ips/job/stdout_report.rb
|
12
|
+
lib/benchmark/ips/noop_suite.rb
|
11
13
|
lib/benchmark/ips/report.rb
|
12
14
|
lib/benchmark/ips/share.rb
|
13
15
|
lib/benchmark/ips/stats/bootstrap.rb
|
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
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Benchmark
|
2
|
+
module IPS
|
3
|
+
class Job
|
4
|
+
class NoopReport
|
5
|
+
def start_warming
|
6
|
+
end
|
7
|
+
|
8
|
+
def start_running
|
9
|
+
end
|
10
|
+
|
11
|
+
def footer
|
12
|
+
end
|
13
|
+
|
14
|
+
def warming(a, b)
|
15
|
+
end
|
16
|
+
|
17
|
+
def warmup_stats(a, b)
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_report(a, b)
|
21
|
+
end
|
22
|
+
|
23
|
+
alias_method :running, :warming
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Benchmark
|
2
|
+
module IPS
|
3
|
+
class NoopSuite
|
4
|
+
def start_warming
|
5
|
+
end
|
6
|
+
|
7
|
+
def start_running
|
8
|
+
end
|
9
|
+
|
10
|
+
def footer
|
11
|
+
end
|
12
|
+
|
13
|
+
def warming(a, b)
|
14
|
+
end
|
15
|
+
|
16
|
+
def warmup_stats(a, b)
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_report(a, b)
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method :running, :warming
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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/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.1"
|
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/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,14 +1,14 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -77,7 +77,9 @@ files:
|
|
77
77
|
- lib/benchmark/ips.rb
|
78
78
|
- lib/benchmark/ips/job.rb
|
79
79
|
- lib/benchmark/ips/job/entry.rb
|
80
|
+
- lib/benchmark/ips/job/noop_report.rb
|
80
81
|
- lib/benchmark/ips/job/stdout_report.rb
|
82
|
+
- lib/benchmark/ips/noop_suite.rb
|
81
83
|
- lib/benchmark/ips/report.rb
|
82
84
|
- lib/benchmark/ips/share.rb
|
83
85
|
- lib/benchmark/ips/stats/bootstrap.rb
|
@@ -90,7 +92,7 @@ licenses:
|
|
90
92
|
- MIT
|
91
93
|
metadata:
|
92
94
|
homepage_uri: https://github.com/evanphx/benchmark-ips
|
93
|
-
post_install_message:
|
95
|
+
post_install_message:
|
94
96
|
rdoc_options:
|
95
97
|
- "--main"
|
96
98
|
- README.md
|
@@ -107,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
- !ruby/object:Gem::Version
|
108
110
|
version: '0'
|
109
111
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
111
|
-
signing_key:
|
112
|
+
rubygems_version: 3.2.9
|
113
|
+
signing_key:
|
112
114
|
specification_version: 4
|
113
115
|
summary: An iterations per second enhancement to Benchmark.
|
114
116
|
test_files: []
|