benchmark-ips 2.10.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +5 -0
- data/README.md +23 -0
- data/lib/benchmark/ips/report.rb +7 -3
- data/lib/benchmark/ips/stats/sd.rb +2 -2
- data/lib/benchmark/ips.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 194a6da5977a23dc733ade6dadaefe1a7d7215678d6135ff33d5c37304bec993
|
4
|
+
data.tar.gz: e072ffd46009a79e13990e7435e1415ec24fd0407f86d566208fc597b8e33f7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b3a8e41f223d3945daf11329e7cd68b1cc41f9b08b9f3f2e9e5a471a37134782f4e1f78caca102b7b3b08eb179ac4d78868bb1f97bfab4ac1ccef22aa38d42d
|
7
|
+
data.tar.gz: e5cd27c03050929b8edf402264c0f5a32560550ee6d79456d2513ae9b4a76f763f669a32ba4cc3bf7a45e7c086426631c2ba26724a749192fc637046bfd6a495
|
data/History.md
CHANGED
data/README.md
CHANGED
@@ -237,6 +237,29 @@ Benchmark.ips do |x|
|
|
237
237
|
end
|
238
238
|
```
|
239
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
|
+
|
240
263
|
## REQUIREMENTS:
|
241
264
|
|
242
265
|
* None!
|
data/lib/benchmark/ips/report.rb
CHANGED
@@ -183,9 +183,13 @@ module Benchmark
|
|
183
183
|
# Generate json from Report#data to given path.
|
184
184
|
# @param path [String] path to generate json.
|
185
185
|
def generate_json(path)
|
186
|
-
|
187
|
-
|
188
|
-
|
186
|
+
require "json"
|
187
|
+
if path.respond_to?(:write) # STDOUT
|
188
|
+
path.write JSON.pretty_generate(data)
|
189
|
+
else
|
190
|
+
File.open path, "w" do |f|
|
191
|
+
f.write JSON.pretty_generate(data)
|
192
|
+
end
|
189
193
|
end
|
190
194
|
end
|
191
195
|
end
|
@@ -24,9 +24,9 @@ module Benchmark
|
|
24
24
|
# @returns [Array<Float, nil>] the slowdown and the error (not calculated for standard deviation)
|
25
25
|
def slowdown(baseline)
|
26
26
|
if baseline.central_tendency > central_tendency
|
27
|
-
[baseline.central_tendency.to_f / central_tendency,
|
27
|
+
[baseline.central_tendency.to_f / central_tendency, nil]
|
28
28
|
else
|
29
|
-
[central_tendency.to_f / baseline.central_tendency,
|
29
|
+
[central_tendency.to_f / baseline.central_tendency, nil]
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
data/lib/benchmark/ips.rb
CHANGED
@@ -18,10 +18,10 @@ module Benchmark
|
|
18
18
|
module IPS
|
19
19
|
|
20
20
|
# Benchmark-ips Gem version.
|
21
|
-
VERSION = "2.
|
21
|
+
VERSION = "2.11.0"
|
22
22
|
|
23
23
|
# CODENAME of current version.
|
24
|
-
CODENAME = "
|
24
|
+
CODENAME = "We Do This Once A Year"
|
25
25
|
|
26
26
|
# Measure code in block, each code's benchmarked result will display in
|
27
27
|
# iteration per second with standard deviation in given time.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark-ips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
92
|
+
rubygems_version: 3.3.20
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: A iterations per second enhancement to Benchmark.
|