benchmark-ips 2.9.2 → 2.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{History.txt → History.md} +25 -20
- data/LICENSE +20 -0
- data/README.md +0 -24
- data/examples/advanced.rb +20 -0
- data/examples/hold.rb +41 -0
- data/examples/save.rb +50 -0
- data/examples/simple.rb +47 -0
- data/lib/benchmark/compare.rb +0 -0
- data/lib/benchmark/ips/job/entry.rb +0 -0
- data/lib/benchmark/ips/job/noop_report.rb +0 -0
- data/lib/benchmark/ips/job/stdout_report.rb +0 -0
- data/lib/benchmark/ips/job.rb +5 -6
- data/lib/benchmark/ips/noop_suite.rb +0 -0
- data/lib/benchmark/ips/report.rb +0 -0
- data/lib/benchmark/ips/share.rb +0 -0
- data/lib/benchmark/ips/stats/bootstrap.rb +0 -0
- data/lib/benchmark/ips/stats/sd.rb +0 -0
- data/lib/benchmark/ips/stats/stats_metric.rb +0 -0
- data/lib/benchmark/ips.rb +1 -1
- data/lib/benchmark/timing.rb +0 -0
- metadata +18 -38
- data/.autotest +0 -23
- data/Manifest.txt +0 -19
- data/Rakefile +0 -27
- data/test/test_benchmark_ips.rb +0 -254
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5ffa1a7718a0e1228ff02e0473d0ca7596a0e2ed2f1837f8e7d2b6671fee80
|
4
|
+
data.tar.gz: 59f55a6921d0e0c2f85b37724fd1e73175bb45c83ab929476d1eecf6e20fec68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be49c48e45aea4ca566cfb52d8e6b50eefb3e367db9733aea730af7e1191d78171c002dcb5c0308a7fe695764d5c028fcf9b088a7edd55227b7097f4b8d4a1da
|
7
|
+
data.tar.gz: 6c240a8f140c33a7164352be7d60a00e20aca04a91f5727d9753e6fd0aaac58e9a2bed6a3afb72ab290386dbe5bde7757e7206704e9806f53001d40091b4e346
|
data/{History.txt → History.md}
RENAMED
@@ -1,36 +1,41 @@
|
|
1
|
-
|
1
|
+
### 2.9.3 / 2022-01-25
|
2
|
+
|
3
|
+
* Bug fix
|
4
|
+
* All warmups and benchmarks must run at least once
|
5
|
+
|
6
|
+
### 2.9.2 / 2021-10-10
|
2
7
|
|
3
8
|
* Bug fix
|
4
9
|
* Fix a problem with certain configs of quiet mode
|
5
10
|
|
6
|
-
|
11
|
+
### 2.9.1 / 2021-05-24
|
7
12
|
|
8
13
|
* Bug fix
|
9
14
|
* Include all files in gem
|
10
15
|
|
11
|
-
|
16
|
+
### 2.9.0 / 2021-05-21
|
12
17
|
|
13
18
|
* Features
|
14
19
|
* Suite can now be set via an accessor
|
15
20
|
* Default SHARE_URL is now `ips.fastruby.io`, operated by Ombu Labs.
|
16
21
|
|
17
|
-
|
22
|
+
### 2.8.4 / 2020-12-03
|
18
23
|
|
19
24
|
* Bug fix
|
20
25
|
* Fixed hold! when results file does not exist.
|
21
26
|
|
22
|
-
|
27
|
+
### 2.8.3 / 2020-08-28
|
23
28
|
|
24
29
|
* Bug fix
|
25
30
|
* Fixed inaccuracy caused by integer overflows.
|
26
31
|
|
27
|
-
|
32
|
+
### 2.8.2 / 2020-05-04
|
28
33
|
|
29
34
|
* Bug fix
|
30
35
|
* Fixed problems with Manifest.txt.
|
31
36
|
* Empty interim results files are ignored.
|
32
37
|
|
33
|
-
|
38
|
+
### 2.8.0 / 2020-05-01
|
34
39
|
|
35
40
|
* Feature
|
36
41
|
* Allow running with empty ips block.
|
@@ -43,16 +48,16 @@
|
|
43
48
|
* Added some RDoc docs.
|
44
49
|
* Added some examples in examples/
|
45
50
|
|
46
|
-
|
51
|
+
### 2.7.2 / 2016-08-18
|
47
52
|
|
48
53
|
* 1 bug fix:
|
49
54
|
* Restore old accessors. Fixes #76
|
50
55
|
|
51
|
-
|
56
|
+
### 2.7.1 / 2016-08-08
|
52
57
|
|
53
58
|
Add missing files
|
54
59
|
|
55
|
-
|
60
|
+
### 2.7.0 / 2016-08-05
|
56
61
|
|
57
62
|
* 1 minor features:
|
58
63
|
* Add support for confidence intervals
|
@@ -69,9 +74,9 @@ Add missing files
|
|
69
74
|
* Merge pull request #67 from benoittgt/master
|
70
75
|
* Merge pull request #69 from chrisseaton/kalibera-confidence-intervals
|
71
76
|
|
72
|
-
|
77
|
+
### MISSING 2.6.0 and 2.6.1
|
73
78
|
|
74
|
-
|
79
|
+
### 2.5.0 / 2016-02-14
|
75
80
|
|
76
81
|
* 1 minor feature:
|
77
82
|
* Add iterations option.
|
@@ -83,12 +88,12 @@ Add missing files
|
|
83
88
|
* Merge pull request #58 from chrisseaton/iterations
|
84
89
|
* Merge pull request #60 from chrisseaton/significance
|
85
90
|
|
86
|
-
|
91
|
+
### 2.4.1 / 2016-02-12
|
87
92
|
|
88
93
|
* 1 bug fix:
|
89
94
|
* Add missing files to gem
|
90
95
|
|
91
|
-
|
96
|
+
### 2.4.0 / 2016-02-12
|
92
97
|
|
93
98
|
* 1 minor features
|
94
99
|
* Add support for hold! and independent invocations.
|
@@ -123,7 +128,7 @@ Add missing files
|
|
123
128
|
* Merge pull request #56 from chrisseaton/independence
|
124
129
|
* Merge pull request #57 from chrisseaton/tighten-loop
|
125
130
|
|
126
|
-
|
131
|
+
### 2.3.0 / 2015-07-20
|
127
132
|
|
128
133
|
* 2 minor features:
|
129
134
|
* Support keyword arguments
|
@@ -137,7 +142,7 @@ Add missing files
|
|
137
142
|
* Merge pull request #42 from kbrock/newer_travis
|
138
143
|
* Merge pull request #43 from kbrock/non_to_s_labels
|
139
144
|
|
140
|
-
|
145
|
+
### 2.2.0 / 2015-05-09
|
141
146
|
|
142
147
|
* 1 minor features:
|
143
148
|
* Fix quiet mode
|
@@ -161,7 +166,7 @@ Add missing files
|
|
161
166
|
* Merge pull request #29 from JuanitoFatas/feature/json-export
|
162
167
|
* Merge pull request #26 from JuanitoFatas/feature/takes-symbol-as-report-parameter
|
163
168
|
|
164
|
-
|
169
|
+
### 2.1.1 / 2015-01-12
|
165
170
|
|
166
171
|
* 1 minor fix:
|
167
172
|
* Don't send label through printf so that % work directly
|
@@ -175,7 +180,7 @@ Add missing files
|
|
175
180
|
* 1 PR merged:
|
176
181
|
* Merge pull request #24 from zzak/simple-format-result-description
|
177
182
|
|
178
|
-
|
183
|
+
### 2.1.0 / 2014-11-10
|
179
184
|
|
180
185
|
* Documentation changes:
|
181
186
|
* Many documentation fixes by Juanito Fatas!
|
@@ -186,7 +191,7 @@ Add missing files
|
|
186
191
|
* Formatting of large values improved (human vs raw mode)
|
187
192
|
* Contributed by Charles Oliver Nutter
|
188
193
|
|
189
|
-
|
194
|
+
### 2.0.0 / 2014-06-18
|
190
195
|
|
191
196
|
* The 'Davy Stevenson' release!
|
192
197
|
* Codename: Springtime Hummingbird Dance
|
@@ -204,7 +209,7 @@ Add missing files
|
|
204
209
|
* Zachary Scott
|
205
210
|
* schneems (Richard Schneeman)
|
206
211
|
|
207
|
-
|
212
|
+
### 1.0.0 / 2012-03-23
|
208
213
|
|
209
214
|
* 1 major enhancement
|
210
215
|
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 Evan Phoenix
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -254,27 +254,3 @@ After checking out the source, run:
|
|
254
254
|
This task will install any missing dependencies, run the tests/specs,
|
255
255
|
and generate the RDoc.
|
256
256
|
|
257
|
-
## LICENSE:
|
258
|
-
|
259
|
-
(The MIT License)
|
260
|
-
|
261
|
-
Copyright (c) 2015 Evan Phoenix
|
262
|
-
|
263
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
264
|
-
a copy of this software and associated documentation files (the
|
265
|
-
'Software'), to deal in the Software without restriction, including
|
266
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
267
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
268
|
-
permit persons to whom the Software is furnished to do so, subject to
|
269
|
-
the following conditions:
|
270
|
-
|
271
|
-
The above copyright notice and this permission notice shall be
|
272
|
-
included in all copies or substantial portions of the Software.
|
273
|
-
|
274
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
275
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
276
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
277
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
278
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
279
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
280
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'benchmark/ips'
|
4
|
+
|
5
|
+
Benchmark.ips do |x|
|
6
|
+
|
7
|
+
# Use bootstrap confidence intervals
|
8
|
+
x.stats = :bootstrap
|
9
|
+
|
10
|
+
# Set confidence to 95%
|
11
|
+
x.confidence = 95
|
12
|
+
|
13
|
+
# Run multiple iterations for better warmup
|
14
|
+
x.iterations = 3
|
15
|
+
|
16
|
+
x.report("mul") { 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 }
|
17
|
+
x.report("pow") { 2 ** 8 }
|
18
|
+
|
19
|
+
x.compare!
|
20
|
+
end
|
data/examples/hold.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# example to explain hold! usage https://github.com/evanphx/benchmark-ips/issues/85
|
3
|
+
# The hold! feature expects to be run twice, generally with different Rubys.
|
4
|
+
# hold! can also be used to compare modules changes which impact the run time
|
5
|
+
# RUN_1: ruby examples/hold.rb
|
6
|
+
# Warming up --------------------------------------
|
7
|
+
# without 172.168k i/100ms
|
8
|
+
# Calculating -------------------------------------
|
9
|
+
# without 2.656M (± 3.3%) i/s - 13.429M in 5.062098s
|
10
|
+
#
|
11
|
+
# RUN_2: WITH_MODULE=true ruby examples/hold.rb
|
12
|
+
# Warming up --------------------------------------
|
13
|
+
# with 92.087k i/100ms
|
14
|
+
# Calculating -------------------------------------
|
15
|
+
# with 1.158M (± 1.4%) i/s - 5.801M in 5.010084s
|
16
|
+
#
|
17
|
+
# Comparison:
|
18
|
+
# without: 2464721.3 i/s
|
19
|
+
# with: 1158179.6 i/s - 2.13x slower
|
20
|
+
require 'benchmark/ips'
|
21
|
+
|
22
|
+
Benchmark.ips do |x|
|
23
|
+
x.report('without') do
|
24
|
+
'Bruce'.inspect
|
25
|
+
end
|
26
|
+
|
27
|
+
if ENV['WITH_MODULE'] == 'true'
|
28
|
+
class String
|
29
|
+
def inspect
|
30
|
+
result = %w[Bruce Wayne is Batman]
|
31
|
+
result.join(' ')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
x.report('with') do
|
37
|
+
'Bruce'.inspect
|
38
|
+
end
|
39
|
+
x.hold! 'temp_results'
|
40
|
+
x.compare!
|
41
|
+
end
|
data/examples/save.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# example to explain save!
|
4
|
+
# The save! feature expects to be run twice, generally with different Rubys.
|
5
|
+
# save! can also be used to compare modules changes which impact the run time
|
6
|
+
#
|
7
|
+
# If you're comparing ruby versions, Just use the version in the label
|
8
|
+
#
|
9
|
+
# x.report("ruby #{RUBY_VERSION}") { 'Bruce'.inspect }
|
10
|
+
#
|
11
|
+
# Or use a hash
|
12
|
+
#
|
13
|
+
# x.report("version" => RUBY_VERSION, "method" => 'bruce') { 'Bruce'.inspect }
|
14
|
+
#
|
15
|
+
# RUN_1: SAVE_FILE='run1.out' ruby examples/hold.rb
|
16
|
+
# Warming up --------------------------------------
|
17
|
+
# without 172.168k i/100ms
|
18
|
+
# Calculating -------------------------------------
|
19
|
+
# without 2.656M (± 3.3%) i/s - 13.429M in 5.062098s
|
20
|
+
#
|
21
|
+
# RUN_2: SAVE_FILE='run1.out' WITH_MODULE=true ruby examples/hold.rb
|
22
|
+
# Warming up --------------------------------------
|
23
|
+
# with 92.087k i/100ms
|
24
|
+
# Calculating -------------------------------------
|
25
|
+
# with 1.158M (± 1.4%) i/s - 5.801M in 5.010084s
|
26
|
+
#
|
27
|
+
# Comparison:
|
28
|
+
# without: 2464721.3 i/s
|
29
|
+
# with: 1158179.6 i/s - 2.13x slower
|
30
|
+
# CLEANUP: rm run1.out
|
31
|
+
|
32
|
+
require 'benchmark/ips'
|
33
|
+
|
34
|
+
Benchmark.ips do |x|
|
35
|
+
x.report(ENV['WITH_MODULE'] == 'true' ? 'with' : 'without') do
|
36
|
+
'Bruce'.inspect
|
37
|
+
end
|
38
|
+
|
39
|
+
if ENV['WITH_MODULE'] == 'true'
|
40
|
+
class String
|
41
|
+
def inspect
|
42
|
+
result = %w[Bruce Wayne is Batman]
|
43
|
+
result.join(' ')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
x.save! ENV['SAVE_FILE'] if ENV['SAVE_FILE']
|
49
|
+
x.compare!
|
50
|
+
end
|
data/examples/simple.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'benchmark/ips'
|
4
|
+
|
5
|
+
Benchmark.ips do |x|
|
6
|
+
|
7
|
+
# Configure the number of seconds used during
|
8
|
+
# the warmup phase and calculation phase
|
9
|
+
x.config(:time => 5, :warmup => 2)
|
10
|
+
|
11
|
+
# These parameters can also be configured this way
|
12
|
+
x.time = 5
|
13
|
+
x.warmup = 2
|
14
|
+
|
15
|
+
# Typical mode, runs the block as many times as it can
|
16
|
+
x.report("addition") { 1 + 2 }
|
17
|
+
|
18
|
+
# To reduce overhead, the number of iterations is passed in
|
19
|
+
# and the block must run the code the specific number of times.
|
20
|
+
# Used for when the workload is very small and any overhead
|
21
|
+
# introduces incorrectable errors.
|
22
|
+
x.report(:addition2) do |times|
|
23
|
+
i = 0
|
24
|
+
while i < times
|
25
|
+
1 + 2
|
26
|
+
i += 1
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# To reduce overhead even more, grafts the code given into
|
31
|
+
# the loop that performs the iterations internally to reduce
|
32
|
+
# overhead. Typically not needed, use the |times| form instead.
|
33
|
+
x.report("addition3", "1 + 2")
|
34
|
+
|
35
|
+
# Really long labels should be formatted correctly
|
36
|
+
x.report("addition-test-long-label") { 1 + 2 }
|
37
|
+
|
38
|
+
x.compare!
|
39
|
+
end
|
40
|
+
|
41
|
+
puts <<-EOD
|
42
|
+
Typical results will show addition2 & addition3 to be the most performant, and
|
43
|
+
they should perform reasonably similarly. You should see addition and
|
44
|
+
addition-test-long-label to perform very similarly to each other (as they are
|
45
|
+
running the same test, just with different labels), and they should both run in
|
46
|
+
the neighborhood of 3.5 times slower than addition2 and addition3."
|
47
|
+
EOD
|
data/lib/benchmark/compare.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/benchmark/ips/job.rb
CHANGED
@@ -276,9 +276,7 @@ module Benchmark
|
|
276
276
|
target = Timing.add_second before, @warmup / 2.0
|
277
277
|
|
278
278
|
cycles = 1
|
279
|
-
|
280
|
-
warmup_time_us = 0.0
|
281
|
-
while Timing.now + warmup_time_us * 2 < target
|
279
|
+
begin
|
282
280
|
t0 = Timing.now
|
283
281
|
item.call_times cycles
|
284
282
|
t1 = Timing.now
|
@@ -289,7 +287,7 @@ module Benchmark
|
|
289
287
|
# then exit the loop to avoid overflows and start the 100ms warmup runs
|
290
288
|
break if cycles >= POW_2_30
|
291
289
|
cycles *= 2
|
292
|
-
end
|
290
|
+
end while Timing.now + warmup_time_us * 2 < target
|
293
291
|
|
294
292
|
cycles = cycles_per_100ms warmup_time_us, warmup_iter
|
295
293
|
@timing[item] = cycles
|
@@ -326,7 +324,8 @@ module Benchmark
|
|
326
324
|
|
327
325
|
target = Timing.add_second Timing.now, @time
|
328
326
|
|
329
|
-
|
327
|
+
begin
|
328
|
+
before = Timing.now
|
330
329
|
item.call_times cycles
|
331
330
|
after = Timing.now
|
332
331
|
|
@@ -338,7 +337,7 @@ module Benchmark
|
|
338
337
|
iter += cycles
|
339
338
|
|
340
339
|
measurements_us << iter_us
|
341
|
-
end
|
340
|
+
end while Timing.now < target
|
342
341
|
|
343
342
|
final_time = before
|
344
343
|
|
File without changes
|
data/lib/benchmark/ips/report.rb
CHANGED
File without changes
|
data/lib/benchmark/ips/share.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/benchmark/ips.rb
CHANGED
data/lib/benchmark/timing.rb
CHANGED
File without changes
|
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.9.
|
4
|
+
version: 2.9.3
|
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: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -16,63 +16,45 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.4'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
26
|
+
version: '5.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '4.0'
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '7'
|
37
|
-
type: :development
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '4.0'
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '7'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: hoe
|
49
29
|
requirement: !ruby/object:Gem::Requirement
|
50
30
|
requirements:
|
51
31
|
- - "~>"
|
52
32
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
33
|
+
version: '4.0'
|
54
34
|
type: :development
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
37
|
requirements:
|
58
38
|
- - "~>"
|
59
39
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
61
|
-
description:
|
40
|
+
version: '4.0'
|
41
|
+
description: A iterations per second enhancement to Benchmark.
|
62
42
|
email:
|
63
43
|
- evan@phx.io
|
64
44
|
executables: []
|
65
45
|
extensions: []
|
66
46
|
extra_rdoc_files:
|
67
|
-
- History.
|
68
|
-
-
|
47
|
+
- History.md
|
48
|
+
- LICENSE
|
69
49
|
- README.md
|
70
50
|
files:
|
71
|
-
-
|
72
|
-
-
|
73
|
-
- Manifest.txt
|
51
|
+
- History.md
|
52
|
+
- LICENSE
|
74
53
|
- README.md
|
75
|
-
-
|
54
|
+
- examples/advanced.rb
|
55
|
+
- examples/hold.rb
|
56
|
+
- examples/save.rb
|
57
|
+
- examples/simple.rb
|
76
58
|
- lib/benchmark/compare.rb
|
77
59
|
- lib/benchmark/ips.rb
|
78
60
|
- lib/benchmark/ips/job.rb
|
@@ -86,12 +68,10 @@ files:
|
|
86
68
|
- lib/benchmark/ips/stats/sd.rb
|
87
69
|
- lib/benchmark/ips/stats/stats_metric.rb
|
88
70
|
- lib/benchmark/timing.rb
|
89
|
-
- test/test_benchmark_ips.rb
|
90
71
|
homepage: https://github.com/evanphx/benchmark-ips
|
91
72
|
licenses:
|
92
73
|
- MIT
|
93
|
-
metadata:
|
94
|
-
homepage_uri: https://github.com/evanphx/benchmark-ips
|
74
|
+
metadata: {}
|
95
75
|
post_install_message:
|
96
76
|
rdoc_options:
|
97
77
|
- "--main"
|
@@ -109,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
89
|
- !ruby/object:Gem::Version
|
110
90
|
version: '0'
|
111
91
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
92
|
+
rubygems_version: 3.2.26
|
113
93
|
signing_key:
|
114
94
|
specification_version: 4
|
115
|
-
summary:
|
95
|
+
summary: A iterations per second enhancement to Benchmark.
|
116
96
|
test_files: []
|
data/.autotest
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'autotest/restart'
|
4
|
-
|
5
|
-
# Autotest.add_hook :initialize do |at|
|
6
|
-
# at.extra_files << "../some/external/dependency.rb"
|
7
|
-
#
|
8
|
-
# at.libs << ":../some/external"
|
9
|
-
#
|
10
|
-
# at.add_exception 'vendor'
|
11
|
-
#
|
12
|
-
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
-
# at.files_matching(/test_.*rb$/)
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# %w(TestA TestB).each do |klass|
|
17
|
-
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
-
# end
|
19
|
-
# end
|
20
|
-
|
21
|
-
# Autotest.add_hook :run_command do |at|
|
22
|
-
# system "rake build"
|
23
|
-
# end
|
data/Manifest.txt
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
.autotest
|
2
|
-
History.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.md
|
5
|
-
Rakefile
|
6
|
-
lib/benchmark/compare.rb
|
7
|
-
lib/benchmark/ips.rb
|
8
|
-
lib/benchmark/ips/job.rb
|
9
|
-
lib/benchmark/ips/job/entry.rb
|
10
|
-
lib/benchmark/ips/job/noop_report.rb
|
11
|
-
lib/benchmark/ips/job/stdout_report.rb
|
12
|
-
lib/benchmark/ips/noop_suite.rb
|
13
|
-
lib/benchmark/ips/report.rb
|
14
|
-
lib/benchmark/ips/share.rb
|
15
|
-
lib/benchmark/ips/stats/bootstrap.rb
|
16
|
-
lib/benchmark/ips/stats/sd.rb
|
17
|
-
lib/benchmark/ips/stats/stats_metric.rb
|
18
|
-
lib/benchmark/timing.rb
|
19
|
-
test/test_benchmark_ips.rb
|
data/Rakefile
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
|
-
|
6
|
-
Hoe.plugin :minitest
|
7
|
-
Hoe.plugin :git
|
8
|
-
Hoe.plugin :ignore
|
9
|
-
|
10
|
-
hoe = Hoe.spec 'benchmark-ips' do
|
11
|
-
developer('Evan Phoenix', 'evan@phx.io')
|
12
|
-
|
13
|
-
self.readme_file = 'README.md'
|
14
|
-
|
15
|
-
license "MIT"
|
16
|
-
end
|
17
|
-
|
18
|
-
file "#{hoe.spec.name}.gemspec" => ['Rakefile', "lib/benchmark/ips.rb"] do |t|
|
19
|
-
puts "Generating #{t.name}"
|
20
|
-
File.open(t.name, 'wb') { |f| f.write hoe.spec.to_ruby }
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "Generate or update the standalone gemspec file for the project"
|
24
|
-
task :gemspec => ["#{hoe.spec.name}.gemspec"]
|
25
|
-
|
26
|
-
|
27
|
-
# vim: syntax=ruby
|
data/test/test_benchmark_ips.rb
DELETED
@@ -1,254 +0,0 @@
|
|
1
|
-
require "minitest/autorun"
|
2
|
-
require "benchmark/ips"
|
3
|
-
require "stringio"
|
4
|
-
require "tmpdir"
|
5
|
-
|
6
|
-
class TestBenchmarkIPS < Minitest::Test
|
7
|
-
def setup
|
8
|
-
@old_stdout = $stdout
|
9
|
-
$stdout = StringIO.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
$stdout = @old_stdout
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_all_lib_files_are_included_in_manifest
|
17
|
-
project_root = File.expand_path('../..', __FILE__)
|
18
|
-
manifest = File.readlines("#{project_root}/Manifest.txt").map(&:chomp)
|
19
|
-
lib_files = Dir["#{project_root}/lib/**/*.rb"].map { |path| path.sub("#{project_root}/", '') }
|
20
|
-
lib_files.each { |lib_file| assert_includes manifest, lib_file }
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_kwargs
|
24
|
-
Benchmark.ips(:time => 1, :warmup => 1, :quiet => false) do |x|
|
25
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
26
|
-
end
|
27
|
-
|
28
|
-
assert $stdout.string.size > 0
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_warmup0
|
32
|
-
$stdout = @old_stdout
|
33
|
-
|
34
|
-
out, err = capture_io do
|
35
|
-
Benchmark.ips(:time => 1, :warmup => 0, :quiet => false) do |x|
|
36
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
refute_match(/Warming up -+/, out)
|
41
|
-
assert_empty err
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_output
|
45
|
-
Benchmark.ips(1) do |x|
|
46
|
-
x.report("operation") { 100 * 100 }
|
47
|
-
end
|
48
|
-
|
49
|
-
assert $stdout.string.size > 0
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_quiet
|
53
|
-
Benchmark.ips(1, nil, true) do |x|
|
54
|
-
x.report("operation") { 100 * 100 }
|
55
|
-
end
|
56
|
-
|
57
|
-
assert $stdout.string.size.zero?
|
58
|
-
|
59
|
-
Benchmark.ips(:quiet => true) do |x|
|
60
|
-
x.report("operation") { 100 * 100 }
|
61
|
-
end
|
62
|
-
|
63
|
-
assert $stdout.string.size.zero?
|
64
|
-
|
65
|
-
Benchmark.ips do |x|
|
66
|
-
x.quiet = true
|
67
|
-
x.report("operation") { 100 * 100 }
|
68
|
-
end
|
69
|
-
|
70
|
-
assert $stdout.string.size.zero?
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_quiet_option_override
|
74
|
-
Benchmark.ips(quiet: true) do |x|
|
75
|
-
x.quiet = false
|
76
|
-
x.report("operation") { 100 * 100 }
|
77
|
-
end
|
78
|
-
|
79
|
-
assert $stdout.string.size > 0
|
80
|
-
$stdout.truncate(0)
|
81
|
-
|
82
|
-
Benchmark.ips(quiet: true) do |x|
|
83
|
-
x.config(quiet: false)
|
84
|
-
x.report("operation") { 100 * 100 }
|
85
|
-
end
|
86
|
-
|
87
|
-
assert $stdout.string.size > 0
|
88
|
-
$stdout.truncate(0)
|
89
|
-
|
90
|
-
Benchmark.ips(quiet: true) do |x|
|
91
|
-
# Calling config should not make quiet option overridden when no specified
|
92
|
-
x.config({})
|
93
|
-
x.report("operation") { 100 * 100 }
|
94
|
-
end
|
95
|
-
|
96
|
-
assert $stdout.string.size.zero?
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_ips
|
100
|
-
report = Benchmark.ips do |x|
|
101
|
-
x.config(:time => 1, :warmup => 1)
|
102
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
103
|
-
x.report("sleep 0.05") { sleep(0.05) }
|
104
|
-
x.compare!
|
105
|
-
end
|
106
|
-
|
107
|
-
rep1 = report.entries[0]
|
108
|
-
rep2 = report.entries[1]
|
109
|
-
|
110
|
-
assert_equal "sleep 0.25", rep1.label
|
111
|
-
assert_equal 4, rep1.iterations
|
112
|
-
assert_in_delta 4.0, rep1.ips, 0.2
|
113
|
-
|
114
|
-
assert_equal "sleep 0.05", rep2.label
|
115
|
-
assert_in_delta 20.0, rep2.iterations.to_f, 1.0
|
116
|
-
assert_in_delta 20.0, rep2.ips, 2.0
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_ips_alternate_config
|
120
|
-
report = Benchmark.ips do |x|
|
121
|
-
x.time = 1
|
122
|
-
x.warmup = 1
|
123
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
124
|
-
end
|
125
|
-
|
126
|
-
rep = report.entries.first
|
127
|
-
|
128
|
-
assert_equal "sleep 0.25", rep.label
|
129
|
-
assert_equal 4, rep.iterations
|
130
|
-
assert_in_delta 4.0, rep.ips, 0.4
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_ips_old_config
|
134
|
-
report = Benchmark.ips(1,1) do |x|
|
135
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
136
|
-
end
|
137
|
-
|
138
|
-
rep = report.entries.first
|
139
|
-
|
140
|
-
assert_equal "sleep 0.25", rep.label
|
141
|
-
assert_equal 4, rep.iterations
|
142
|
-
assert_in_delta 4.0, rep.ips, 0.2
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_ips_config_suite
|
146
|
-
suite = Struct.new(:calls) do
|
147
|
-
def method_missing(method, *args)
|
148
|
-
calls << method
|
149
|
-
end
|
150
|
-
end.new([])
|
151
|
-
|
152
|
-
Benchmark.ips(0.1, 0.1) do |x|
|
153
|
-
x.config(:suite => suite)
|
154
|
-
x.report("job") {}
|
155
|
-
end
|
156
|
-
|
157
|
-
assert_equal [:warming, :warmup_stats, :running, :add_report], suite.calls
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_ips_config_suite_by_accsr
|
161
|
-
suite = Struct.new(:calls) do
|
162
|
-
def method_missing(method, *args)
|
163
|
-
calls << method
|
164
|
-
end
|
165
|
-
end.new([])
|
166
|
-
|
167
|
-
Benchmark.ips(0.1, 0.1) do |x|
|
168
|
-
x.suite = suite
|
169
|
-
x.report("job") {}
|
170
|
-
end
|
171
|
-
|
172
|
-
assert_equal [:warming, :warmup_stats, :running, :add_report], suite.calls
|
173
|
-
end
|
174
|
-
|
175
|
-
def test_ips_defaults
|
176
|
-
report = Benchmark.ips do |x|
|
177
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
178
|
-
end
|
179
|
-
|
180
|
-
rep = report.entries.first
|
181
|
-
|
182
|
-
assert_equal "sleep 0.25", rep.label
|
183
|
-
assert_equal 4*5, rep.iterations
|
184
|
-
assert_in_delta 4.0, rep.ips, 0.2
|
185
|
-
end
|
186
|
-
|
187
|
-
def test_ips_report_using_symbol
|
188
|
-
report = Benchmark.ips do |x|
|
189
|
-
x.report(:sleep_a_quarter_second) { sleep(0.25) }
|
190
|
-
end
|
191
|
-
|
192
|
-
rep = report.entries.first
|
193
|
-
|
194
|
-
assert_equal :sleep_a_quarter_second, rep.label
|
195
|
-
assert_equal 4*5, rep.iterations
|
196
|
-
assert_in_delta 4.0, rep.ips, 0.2
|
197
|
-
end
|
198
|
-
|
199
|
-
def test_ips_default_data
|
200
|
-
report = Benchmark.ips do |x|
|
201
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
202
|
-
end
|
203
|
-
|
204
|
-
all_data = report.data
|
205
|
-
|
206
|
-
assert all_data
|
207
|
-
assert_equal "sleep 0.25", all_data[0][:name]
|
208
|
-
assert all_data[0][:ips]
|
209
|
-
assert all_data[0][:stddev]
|
210
|
-
end
|
211
|
-
|
212
|
-
def test_ips_empty
|
213
|
-
report = Benchmark.ips do |_x|
|
214
|
-
|
215
|
-
end
|
216
|
-
|
217
|
-
all_data = report.data
|
218
|
-
|
219
|
-
assert all_data
|
220
|
-
assert_equal [], all_data
|
221
|
-
end
|
222
|
-
|
223
|
-
def test_json_output
|
224
|
-
json_file = Tempfile.new("data.json")
|
225
|
-
|
226
|
-
Benchmark.ips do |x|
|
227
|
-
x.report("sleep 0.25") { sleep(0.25) }
|
228
|
-
x.json! json_file.path
|
229
|
-
end
|
230
|
-
|
231
|
-
json_data = json_file.read
|
232
|
-
assert json_data
|
233
|
-
|
234
|
-
data = JSON.parse json_data
|
235
|
-
assert data
|
236
|
-
assert_equal 1, data.size
|
237
|
-
assert_equal "sleep 0.25", data[0]["name"]
|
238
|
-
assert data[0]["ips"]
|
239
|
-
assert data[0]["stddev"]
|
240
|
-
end
|
241
|
-
|
242
|
-
def test_hold!
|
243
|
-
temp_file_name = Dir::Tmpname.create(["benchmark-ips", ".tmp"]) { }
|
244
|
-
|
245
|
-
Benchmark.ips(:time => 0.001, :warmup => 0.001) do |x|
|
246
|
-
x.report("operation") { 100 * 100 }
|
247
|
-
x.report("operation2") { 100 * 100 }
|
248
|
-
x.hold! temp_file_name
|
249
|
-
end
|
250
|
-
|
251
|
-
assert File.exist?(temp_file_name)
|
252
|
-
File.unlink(temp_file_name)
|
253
|
-
end
|
254
|
-
end
|