benchmark-ips 2.3.0 → 2.11.0

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
- SHA1:
3
- metadata.gz: ac378dafa55fa25f223374c352d9fce265a73a1d
4
- data.tar.gz: edcbad0a3ed40b69793e18b52b40b4d2d73b72fd
2
+ SHA256:
3
+ metadata.gz: 194a6da5977a23dc733ade6dadaefe1a7d7215678d6135ff33d5c37304bec993
4
+ data.tar.gz: e072ffd46009a79e13990e7435e1415ec24fd0407f86d566208fc597b8e33f7d
5
5
  SHA512:
6
- metadata.gz: 427e884910dc92a0e50ceb825ff36770b70c0dcee9088f56d3e090867986f6c8d12d176c7a671d7b964f15c12c2ae6edd4c87b532c6c68bdd351c0508c03fd90
7
- data.tar.gz: 3db5f1f4445eb0b2c4985633a197abf58be95f9a2bb01282bda329c2880916e1c25c5cd0ec94b2a17adbdc667e3e8829dd46fa428ef13dc41cf3327136564d89
6
+ metadata.gz: 5b3a8e41f223d3945daf11329e7cd68b1cc41f9b08b9f3f2e9e5a471a37134782f4e1f78caca102b7b3b08eb179ac4d78868bb1f97bfab4ac1ccef22aa38d42d
7
+ data.tar.gz: e5cd27c03050929b8edf402264c0f5a32560550ee6d79456d2513ae9b4a76f763f669a32ba4cc3bf7a45e7c086426631c2ba26724a749192fc637046bfd6a495
data/History.md ADDED
@@ -0,0 +1,228 @@
1
+ ### 2.11.0 / 2023-02-15
2
+
3
+ * Feature
4
+ * Adds .json! method to the ips block argument, allowing you to print the output as JSON to a file or STDOUT.
5
+
6
+ ### 2.10.0 / 2022-02-17
7
+
8
+ * Feature
9
+ * Adds :order option to compare, with new `:baseline` order which compares all
10
+ variations against the first option benchmarked.
11
+
12
+ ### 2.9.3 / 2022-01-25
13
+
14
+ * Bug fix
15
+ * All warmups and benchmarks must run at least once
16
+
17
+ ### 2.9.2 / 2021-10-10
18
+
19
+ * Bug fix
20
+ * Fix a problem with certain configs of quiet mode
21
+
22
+ ### 2.9.1 / 2021-05-24
23
+
24
+ * Bug fix
25
+ * Include all files in gem
26
+
27
+ ### 2.9.0 / 2021-05-21
28
+
29
+ * Features
30
+ * Suite can now be set via an accessor
31
+ * Default SHARE_URL is now `ips.fastruby.io`, operated by Ombu Labs.
32
+
33
+ ### 2.8.4 / 2020-12-03
34
+
35
+ * Bug fix
36
+ * Fixed hold! when results file does not exist.
37
+
38
+ ### 2.8.3 / 2020-08-28
39
+
40
+ * Bug fix
41
+ * Fixed inaccuracy caused by integer overflows.
42
+
43
+ ### 2.8.2 / 2020-05-04
44
+
45
+ * Bug fix
46
+ * Fixed problems with Manifest.txt.
47
+ * Empty interim results files are ignored.
48
+
49
+ ### 2.8.0 / 2020-05-01
50
+
51
+ * Feature
52
+ * Allow running with empty ips block.
53
+ * Added save! method for saving interim results.
54
+ * Run more than just 1 cycle during warmup to reduce overhead.
55
+ * Optimized Job::Entry hot-path for fairer results on JRuby/TruffleRuby.
56
+
57
+ * Bug fix
58
+ * Removed the warmup section if set to 0.
59
+ * Added some RDoc docs.
60
+ * Added some examples in examples/
61
+
62
+ ### 2.7.2 / 2016-08-18
63
+
64
+ * 1 bug fix:
65
+ * Restore old accessors. Fixes #76
66
+
67
+ ### 2.7.1 / 2016-08-08
68
+
69
+ Add missing files
70
+
71
+ ### 2.7.0 / 2016-08-05
72
+
73
+ * 1 minor features:
74
+ * Add support for confidence intervals
75
+
76
+ * 1 bug fixes:
77
+ * Cleanup a few coding patterns
78
+
79
+ * 2 doc fixes:
80
+ * Add infos about benchark.fyi to Readme
81
+ * Remove ancient releases
82
+
83
+ * 3 merged PRs:
84
+ * Merge pull request #65 from kbrock/fixup_inject
85
+ * Merge pull request #67 from benoittgt/master
86
+ * Merge pull request #69 from chrisseaton/kalibera-confidence-intervals
87
+
88
+ ### MISSING 2.6.0 and 2.6.1
89
+
90
+ ### 2.5.0 / 2016-02-14
91
+
92
+ * 1 minor feature:
93
+ * Add iterations option.
94
+
95
+ * 1 bug fixes:
96
+ * Don't tell people something is slower if it's within the error.
97
+
98
+ * 2 merged PRs:
99
+ * Merge pull request #58 from chrisseaton/iterations
100
+ * Merge pull request #60 from chrisseaton/significance
101
+
102
+ ### 2.4.1 / 2016-02-12
103
+
104
+ * 1 bug fix:
105
+ * Add missing files to gem
106
+
107
+ ### 2.4.0 / 2016-02-12
108
+
109
+ * 1 minor features
110
+ * Add support for hold! and independent invocations.
111
+
112
+ * 6 bug fixes
113
+ * Separate messages for warming up and calculating.
114
+ * Tighten timing loop.
115
+ * Pass simple types into Job#create_report
116
+ * More concise sorting
117
+ * Fix runtime comparison
118
+ * Use runtime if ips is not available
119
+
120
+ * 5 doc fixes
121
+ * Fix typo unsed --> used
122
+ * Better document Report::Entry
123
+ * Fix some typos in docs
124
+ * Don't calculate mean 2 times
125
+ * Add more tolerance to tests
126
+
127
+ * 13 merged PRs
128
+ * Merge pull request #44 from kbrock/job_extract
129
+ * Merge pull request #45 from kbrock/runtime_only
130
+ * Merge pull request #47 from kbrock/use_avg
131
+ * Merge pull request #46 from kbrock/report_stdout
132
+ * Merge pull request #48 from bquorning/fix-label-for-runtime-comparison
133
+ * Merge pull request #50 from tjschuck/fix_typo
134
+ * Merge pull request #51 from bquorning/all-reports-respond-to-ips
135
+ * Merge pull request #52 from kbrock/document_reports
136
+ * Merge pull request #53 from kbrock/interface_create_report
137
+ * Merge pull request #54 from PragTob/patch-2
138
+ * Merge pull request #55 from chrisseaton/messages
139
+ * Merge pull request #56 from chrisseaton/independence
140
+ * Merge pull request #57 from chrisseaton/tighten-loop
141
+
142
+ ### 2.3.0 / 2015-07-20
143
+
144
+ * 2 minor features:
145
+ * Support keyword arguments
146
+ * Allow any datatype for labels (use #to_s conversion)
147
+
148
+ * 1 doc/test changes:
149
+ * Newer Travis for 1.8.7, ree, and 2.2.2
150
+
151
+ * 3 PRs merged:
152
+ * Merge pull request #41 from kbrock/kwargs-support
153
+ * Merge pull request #42 from kbrock/newer_travis
154
+ * Merge pull request #43 from kbrock/non_to_s_labels
155
+
156
+ ### 2.2.0 / 2015-05-09
157
+
158
+ * 1 minor features:
159
+ * Fix quiet mode
160
+ * Allow passing a custom suite via config
161
+ * Silent a job if a suite was passed and is quiet
162
+ * Export report to json file.
163
+ * Accept symbol as report's argument.
164
+
165
+ * 2 doc fixes:
166
+ * Squish duplicate `to` in README
167
+ * Update copyright to 2015. [ci skip]
168
+
169
+ * 9 PRs merged:
170
+ * Merge pull request #37 from splattael/patch-1
171
+ * Merge pull request #36 from kirs/quiet-mode
172
+ * Merge pull request #35 from JuanitoFatas/doc/suite
173
+ * Merge pull request #34 from splattael/config-suite
174
+ * Merge pull request #33 from splattael/suite-quiet
175
+ * Merge pull request #32 from O-I/remove-gemfile-lock
176
+ * Merge pull request #31 from JuanitoFatas/doc/bump-copyright-year
177
+ * Merge pull request #29 from JuanitoFatas/feature/json-export
178
+ * Merge pull request #26 from JuanitoFatas/feature/takes-symbol-as-report-parameter
179
+
180
+ ### 2.1.1 / 2015-01-12
181
+
182
+ * 1 minor fix:
183
+ * Don't send label through printf so that % work directly
184
+
185
+ * 1 documenation changes:
186
+ * Use HEREDOC and wrap at 80 chars for example result description
187
+
188
+ * 1 usage fix:
189
+ * Add gemspec for use via bundler git
190
+
191
+ * 1 PR merged:
192
+ * Merge pull request #24 from zzak/simple-format-result-description
193
+
194
+ ### 2.1.0 / 2014-11-10
195
+
196
+ * Documentation changes:
197
+ * Many documentation fixes by Juanito Fatas!
198
+ * Minor readme fix by Will Leinweber
199
+
200
+ * 2 minor features:
201
+ * Displaying the total runtime for a job is suppressed unless interesting
202
+ * Formatting of large values improved (human vs raw mode)
203
+ * Contributed by Charles Oliver Nutter
204
+
205
+ ### 2.0.0 / 2014-06-18
206
+
207
+ * The 'Davy Stevenson' release!
208
+ * Codename: Springtime Hummingbird Dance
209
+
210
+ * Big API refactoring so the internal bits are easier to use
211
+ * Bump to 2.0 because return types changed to make the API better
212
+
213
+ * Contributors added:
214
+ * Davy Stevenson
215
+ * Juanito Fatas
216
+ * Benoit Daloze
217
+ * Matias
218
+ * Tony Arcieri
219
+ * Vipul A M
220
+ * Zachary Scott
221
+ * schneems (Richard Schneeman)
222
+
223
+ ### 1.0.0 / 2012-03-23
224
+
225
+ * 1 major enhancement
226
+
227
+ * Birthday!
228
+
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
@@ -1,16 +1,17 @@
1
+ # benchmark-ips
2
+
3
+ * rdoc :: http://rubydoc.info/gems/benchmark-ips
4
+ * home :: https://github.com/evanphx/benchmark-ips
5
+
1
6
  [![Gem Version](https://badge.fury.io/rb/benchmark-ips.svg)](http://badge.fury.io/rb/benchmark-ips)
2
7
  [![Build Status](https://secure.travis-ci.org/evanphx/benchmark-ips.svg)](http://travis-ci.org/evanphx/benchmark-ips)
3
8
  [![Inline docs](http://inch-ci.org/github/evanphx/benchmark-ips.svg)](http://inch-ci.org/github/evanphx/benchmark-ips)
4
9
 
5
- # benchmark-ips
6
-
7
10
  * https://github.com/evanphx/benchmark-ips
8
11
 
9
- * [documentation](http://rubydoc.info/gems/benchmark-ips)
10
-
11
12
  ## DESCRIPTION:
12
13
 
13
- A iterations per second enhancement to Benchmark.
14
+ An iterations per second enhancement to Benchmark.
14
15
 
15
16
  ## FEATURES/PROBLEMS:
16
17
 
@@ -136,6 +137,129 @@ Benchmark.ips do |x|
136
137
  end
137
138
  ```
138
139
 
140
+ ### Independent benchmarking
141
+
142
+ If you are comparing multiple implementations of a piece of code you may want
143
+ to benchmark them in separate invocations of Ruby so that the measurements
144
+ are independent of each other. You can do this with the `hold!` command.
145
+
146
+ ```ruby
147
+ Benchmark.ips do |x|
148
+
149
+ # Hold results between multiple invocations of Ruby
150
+ x.hold! 'filename'
151
+
152
+ end
153
+ ```
154
+
155
+ This will run only one benchmarks each time you run the command, storing
156
+ results in the specified file. The file is deleted when all results have been
157
+ gathered and the report is shown.
158
+
159
+ Alternatively, if you prefer a different approach, the `save!` command is
160
+ available. Examples for [hold!](examples/hold.rb) and [save!](examples/save.rb) are available in
161
+ the `examples/` directory.
162
+
163
+
164
+ ### Multiple iterations
165
+
166
+ In some cases you may want to run multiple iterations of the warmup and
167
+ calculation stages and take only the last result for comparison. This is useful
168
+ if you are benchmarking with an implementation of Ruby that optimizes using
169
+ tracing or on-stack-replacement, because to those implementations the
170
+ calculation phase may appear as new, unoptimized code.
171
+
172
+ You can do this with the `iterations` option, which by default is `1`. The
173
+ total time spent will then be `iterations * warmup + iterations * time` seconds.
174
+
175
+ ```ruby
176
+ Benchmark.ips do |x|
177
+
178
+ x.config(:iterations => 3)
179
+
180
+ # or
181
+
182
+ x.iterations = 3
183
+
184
+ end
185
+ ```
186
+
187
+ ### Online sharing
188
+
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
193
+ will display the link to share the benchmark's result.
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
+
198
+ ### Advanced Statistics
199
+
200
+ By default, the margin of error shown is plus-minus one standard deviation. If
201
+ a more advanced statistical test is wanted, a bootstrap confidence interval
202
+ can be calculated instead. A bootstrap confidence interval has the advantages of
203
+ arguably being more mathematically sound for this application than a standard
204
+ deviation, it additionally produces an error for relative slowdowns, which the
205
+ standard deviation does not, and it is arguably more intuitive and actionable.
206
+
207
+ When a bootstrap confidence interval is used, a median of the interval is used
208
+ rather than the mean of the samples, which is what you get with the default
209
+ standard deviation.
210
+
211
+ The bootstrap confidence interval used is the one described by Tomas Kalibera.
212
+ Note that for this technique to be valid your benchmark should have reached a
213
+ non-periodic steady state with statistically independent samples (it should
214
+ have warmed up) by the time measurements start.
215
+
216
+ Using a bootstrap confidence internal requires that the 'kalibera' gem is
217
+ installed separately. This gem is not a formal dependency, as by default it is
218
+ not needed.
219
+
220
+ ```
221
+ gem install kalibera
222
+ ```
223
+
224
+ ```ruby
225
+ Benchmark.ips do |x|
226
+
227
+ # The default is :stats => :sd, which doesn't have a configurable confidence
228
+ x.config(:stats => :bootstrap, :confidence => 95)
229
+
230
+ # or
231
+
232
+ x.stats = :bootstrap
233
+ x.confidence = 95
234
+
235
+ # confidence is 95% by default, so it can be omitted
236
+
237
+ end
238
+ ```
239
+
240
+ ### Output as JSON
241
+
242
+ You can generate output in JSON. If you want to write JSON to a file, pass filename to `json!` method:
243
+
244
+ ```ruby
245
+ Benchmark.ips do |x|
246
+ x.report("some report") { }
247
+ x.json! 'filename.json'
248
+ end
249
+ ```
250
+
251
+ If you want to write JSON to STDOUT, pass `STDOUT` to `json!` method and set `quiet = true` before `json!`:
252
+
253
+ ```ruby
254
+ Benchmark.ips do |x|
255
+ x.report("some report") { }
256
+ x.quiet = true
257
+ x.json! STDOUT
258
+ end
259
+ ```
260
+
261
+ This is useful when the output from `benchmark-ips` becomes an input of other tools via stdin.
262
+
139
263
  ## REQUIREMENTS:
140
264
 
141
265
  * None!
@@ -153,27 +277,3 @@ After checking out the source, run:
153
277
  This task will install any missing dependencies, run the tests/specs,
154
278
  and generate the RDoc.
155
279
 
156
- ## LICENSE:
157
-
158
- (The MIT License)
159
-
160
- Copyright (c) 2015 Evan Phoenix
161
-
162
- Permission is hereby granted, free of charge, to any person obtaining
163
- a copy of this software and associated documentation files (the
164
- 'Software'), to deal in the Software without restriction, including
165
- without limitation the rights to use, copy, modify, merge, publish,
166
- distribute, sublicense, and/or sell copies of the Software, and to
167
- permit persons to whom the Software is furnished to do so, subject to
168
- the following conditions:
169
-
170
- The above copyright notice and this permission notice shall be
171
- included in all copies or substantial portions of the Software.
172
-
173
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
174
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
175
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
176
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
177
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
178
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
179
- 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
@@ -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