rperf 0.11.0 → 0.11.1

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
2
  SHA256:
3
- metadata.gz: db5be965ca0511ea90e7482309f7dca4dc545a1c83a73f7b3fc08fc4029f9d34
4
- data.tar.gz: 4ae2c1fe82a6d754a1ef0b4759ce2b1a2a22370788ce0197b1d269ba0a1e98e4
3
+ metadata.gz: 3240adc0c0b301a502b663cd9b044e02661c64e072e5a6582ac30d273b349d54
4
+ data.tar.gz: a49b1fab25b96e80f17f942acba4a07aef745a61e565587f791f99c878a0d84e
5
5
  SHA512:
6
- metadata.gz: d99ff20c55b9d359b0dfced5f13cdfaa5f8d4fe1debb5375f2a2de2c7d2ed8a219d2bd4b89c05dbb6ee7fe257b5cf51fa74ad8a85b017db608d6f30d9a5eadf1
7
- data.tar.gz: fefb4b168fc733da575e758933083fd169ee6513ac38624f7d89ba8e66b202b4166bf2cb6d8f6e513fe85fb5fec9e31c48231d036ba19439a4e24e09b077460d
6
+ metadata.gz: 1e5c770faca5dfe03cb87eb83d3021f12b0bbf23433eac923656910fe7275ebe20c08aec7046ab82975ccf2b7b1574bb062493712bee6e2adb5d772e9f60beb6
7
+ data.tar.gz: 776f023349f55073383d78c81736a578cb31f8d1973c49a57b3eef596a132edb1a03e89734fad69f53395c91578a431c27e4952fd6c272b3a069b04dc577c0e7
data/lib/rperf/meta.rb CHANGED
@@ -6,7 +6,11 @@
6
6
  # first two top-level keys, so Meta.read can decompress only the head of the
7
7
  # file and stop as soon as both are extracted.
8
8
 
9
- require "json"
9
+ # NOTE: json is NOT required here. rperf loads via `ruby -rrperf` at interpreter
10
+ # boot, before the profiled app runs `bundler/setup`. Requiring json eagerly
11
+ # would activate the default json gem and then clash with a bundle that pins a
12
+ # different json (Gem::LoadError). json is used only at profile write/read time
13
+ # (after the app has set up its bundle), so each user requires it lazily.
10
14
  require "time"
11
15
  require "zlib"
12
16
 
@@ -103,6 +107,7 @@ module Rperf
103
107
  v = ENV["RPERF_META_GIT"].to_s
104
108
  return nil if v.empty? || v == "null"
105
109
  begin
110
+ require "json"
106
111
  JSON.parse(v, symbolize_names: true)
107
112
  rescue JSON::ParserError
108
113
  nil
@@ -119,6 +124,7 @@ module Rperf
119
124
  v = ENV["RPERF_META_LABELS"]
120
125
  return nil unless v
121
126
  begin
127
+ require "json"
122
128
  labels = JSON.parse(v)
123
129
  labels.is_a?(Hash) ? labels : nil
124
130
  rescue JSON::ParserError
@@ -224,6 +230,7 @@ module Rperf
224
230
  # Returns { meta:, summary: }, nil (old format / malformed),
225
231
  # or :incomplete (need more input).
226
232
  def scan_prefix(buf)
233
+ require "json" # lazy: see the note at the top of this file
227
234
  n = buf.bytesize
228
235
  i = skip_ws(buf, 0, n)
229
236
  return :incomplete if i >= n
data/lib/rperf/table.rb CHANGED
@@ -5,8 +5,11 @@
5
5
  # TSV: header row, data rows, then a trailing "# summary" line of
6
6
  # tab-separated key=value pairs.
7
7
  # JSON: an array of row objects; the last element is { "summary": { ... } }.
8
-
9
- require "json"
8
+ #
9
+ # json is required lazily in the format methods, not here: rperf loads at
10
+ # interpreter boot via `-rrperf`, before the profiled app's bundler/setup, and
11
+ # eagerly activating the default json gem would clash with a bundle that pins a
12
+ # different json (see the note in meta.rb).
10
13
 
11
14
  module Rperf
12
15
  module Table
@@ -67,6 +70,7 @@ module Rperf
67
70
  end
68
71
 
69
72
  def report_json(data)
73
+ require "json"
70
74
  JSON.generate(report_rows(data) + [{ summary: report_summary(data) }])
71
75
  end
72
76
 
@@ -117,6 +121,7 @@ module Rperf
117
121
  end
118
122
 
119
123
  def diff_json(base, head)
124
+ require "json"
120
125
  JSON.generate(diff_rows(base, head) + [{ summary: diff_summary(base, head) }])
121
126
  end
122
127
 
data/lib/rperf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rperf
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rperf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Sasada