duel-retained 0.2.0 → 0.3.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 +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +12 -9
- data/lib/duel/retained/version.rb +1 -1
- data/lib/duel/retained.rb +9 -9
- data/sig/duel/retained.rbs +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ce7ca0ddab16196946303dda0fa93c5da732fa4819575e1da5a52d51aa39799
|
|
4
|
+
data.tar.gz: 9eedcbb943fdd1d74f2484d18608c6d5fd93f5e49db4d4d9bc7dc183cbd92415
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 84e3b8ece4fab02ce721a888e431a06421cfc3da71e267a4638591e4769b2c94f0ec788dfaa642e279759d26983d0c525f82c8dd7a88f5201412002a9e1f6057
|
|
7
|
+
data.tar.gz: 861cf3f68b462fb1993fa9248ab5e5c12c46da13a484366f008e0fbfc355602804529881d26daa7687ee868f679869d265eb68e2b4ffbab9e70aeb7161ee5495
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.0] - 2026-11-20
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `retained_objects`' slack is `per_sample:` (16 objects a sample) and
|
|
15
|
+
`per_iteration:` (one per two iterations), as Duel 0.3.0 names them,
|
|
16
|
+
in place of `allowance:` and `tolerance:`:
|
|
17
|
+
`c.measure("retained_objects", per_sample: 32)`.
|
|
18
|
+
- It requires Duel 0.3.0 or later (`~> 0.3.0`), the release it's
|
|
19
|
+
tested with, as Duel 0.3.0 changes what plugins and benchmarks call.
|
|
20
|
+
|
|
10
21
|
## [0.2.0] - 2026-11-16
|
|
11
22
|
|
|
12
23
|
### Changed
|
|
@@ -72,7 +83,8 @@ on CRuby alone (on JRuby and TruffleRuby it leaves itself out).
|
|
|
72
83
|
CI.
|
|
73
84
|
- RBS signatures in sig/, checked with Steep.
|
|
74
85
|
|
|
75
|
-
[Unreleased]: https://github.com/sferik/duel-ruby/compare/duel-retained-v0.
|
|
86
|
+
[Unreleased]: https://github.com/sferik/duel-ruby/compare/duel-retained-v0.3.0...HEAD
|
|
87
|
+
[0.3.0]: https://github.com/sferik/duel-ruby/compare/duel-retained-v0.2.0...duel-retained-v0.3.0
|
|
76
88
|
[0.2.0]: https://github.com/sferik/duel-ruby/compare/duel-retained-v0.1.8...duel-retained-v0.2.0
|
|
77
89
|
[0.1.8]: https://github.com/sferik/duel-ruby/compare/duel-retained-v0.1.7...duel-retained-v0.1.8
|
|
78
90
|
[0.1.7]: https://github.com/sferik/duel-ruby/compare/duel-retained-v0.1.6...duel-retained-v0.1.7
|
data/README.md
CHANGED
|
@@ -63,17 +63,18 @@ it was made (the three most): see [What it retained](#what-it-retained).
|
|
|
63
63
|
|
|
64
64
|
Install it after any other plugin's metrics: those added after it are
|
|
65
65
|
read inside its measurement, and what they keep of their readings counts
|
|
66
|
-
toward its
|
|
66
|
+
toward what it lets a sample keep (its `per_sample:`).
|
|
67
67
|
|
|
68
68
|
A sample may leave 16 objects alive before any counts against it (its
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
`per_sample:`), and beyond that it's one more per two iterations (its
|
|
70
|
+
`per_iteration:`) that's a regression: see
|
|
71
|
+
[below](#what-it-cant-help-counting).
|
|
71
72
|
Duel's `c.measure` changes either, or leaves the metric out:
|
|
72
73
|
|
|
73
74
|
```ruby
|
|
74
75
|
Duel.configure do |c|
|
|
75
76
|
c.use :retained
|
|
76
|
-
c.measure("retained_objects",
|
|
77
|
+
c.measure("retained_objects", per_sample: 32, per_iteration: 1) # or skip: true
|
|
77
78
|
end
|
|
78
79
|
```
|
|
79
80
|
|
|
@@ -98,7 +99,8 @@ benchmark, for even a large application.
|
|
|
98
99
|
What's measured is the count itself, every object more after the sample
|
|
99
100
|
than before it (or fewer, for one that let go of more than it kept), and
|
|
100
101
|
Duel judges it: a candidate that leaves more alive than the baseline, by
|
|
101
|
-
more than
|
|
102
|
+
more than its `per_sample:` a sample and its `per_iteration:` an
|
|
103
|
+
iteration, fails.
|
|
102
104
|
|
|
103
105
|
### What it can't help counting
|
|
104
106
|
|
|
@@ -115,14 +117,14 @@ always to the object, so a sample is allowed 16 before any is counted.
|
|
|
115
117
|
On top of that, it's one more per two iterations, not one more, that's a
|
|
116
118
|
regression. So for a benchmark that runs thousands of iterations a
|
|
117
119
|
sample, as most do, one object kept an iteration fails. For one that
|
|
118
|
-
runs a few (a slow one, or one with `
|
|
120
|
+
runs a few (a slow one, or one with `judge: :counted`, which runs four),
|
|
119
121
|
it takes more an iteration.
|
|
120
122
|
|
|
121
123
|
What a benchmark makes the first time and keeps (a constant it
|
|
122
124
|
memoizes, a method cache) isn't a leak: Duel runs each benchmark many
|
|
123
125
|
times before it counts, and none of that is counted.
|
|
124
126
|
|
|
125
|
-
Benchmarks with `
|
|
127
|
+
Benchmarks with `judge: :timed` aren't counted at all, so they aren't
|
|
126
128
|
judged on this either.
|
|
127
129
|
|
|
128
130
|
### Untimed blocks
|
|
@@ -136,8 +138,9 @@ What it usually makes, the input a benchmark works on, isn't.
|
|
|
136
138
|
|
|
137
139
|
## What it retained
|
|
138
140
|
|
|
139
|
-
Where a sample retained more than Duel lets through (its
|
|
140
|
-
its
|
|
141
|
+
Where a sample retained more than Duel lets through (its `per_sample:`,
|
|
142
|
+
and its `per_iteration:` for its iterations, as `c.measure` leaves
|
|
143
|
+
them), the
|
|
141
144
|
plugin says what, under the regression: the objects' classes, and where
|
|
142
145
|
they were made, the three most, an iteration (`1 String
|
|
143
146
|
(lib/my_formatter.rb:3)`), of the sample whose count was judged, on
|
data/lib/duel/retained.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Duel
|
|
|
9
9
|
# a full garbage collection that weren't before it (CRuby).
|
|
10
10
|
#
|
|
11
11
|
# - retained_objects: the objects a sample's iterations left alive
|
|
12
|
-
# (counted; beyond
|
|
12
|
+
# (counted; beyond PER_SAMPLE a sample, one more per two iterations is
|
|
13
13
|
# a regression)
|
|
14
14
|
#
|
|
15
15
|
# # .duel.rb
|
|
@@ -31,19 +31,19 @@ module Duel
|
|
|
31
31
|
module Retained
|
|
32
32
|
Duel.plugin(:retained, self)
|
|
33
33
|
|
|
34
|
-
# The retained objects a sample is allowed (Duel's
|
|
34
|
+
# The retained objects a sample is allowed (Duel's per_sample) before
|
|
35
35
|
# any is counted against it: Duel's own record of the metrics inside
|
|
36
36
|
# this one, and what's still on the machine stack when the sample
|
|
37
37
|
# stops (the last iteration's result, or the block's, given n),
|
|
38
38
|
# which are the same few from sample to sample, but not always to the
|
|
39
39
|
# object.
|
|
40
|
-
|
|
40
|
+
PER_SAMPLE = 16
|
|
41
41
|
|
|
42
42
|
# Retained objects per iteration that still aren't a regression.
|
|
43
|
-
|
|
43
|
+
PER_ITERATION = 0.5
|
|
44
44
|
|
|
45
45
|
# The kinds of object (by class, and where they were made) a sample
|
|
46
|
-
# that retained more than
|
|
46
|
+
# that retained more than it's allowed shows, most first.
|
|
47
47
|
SHOWN = 3
|
|
48
48
|
|
|
49
49
|
# Configures Duel for the plugin (c.use :retained): the metric
|
|
@@ -65,7 +65,7 @@ module Duel
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
# Where Duel's own files are: what it makes during a sample (its
|
|
68
|
-
# record of the metrics inside this one) is in
|
|
68
|
+
# record of the metrics inside this one) is in what it's allowed, and
|
|
69
69
|
# isn't shown.
|
|
70
70
|
# (Duel's metric.rb, written in Ruby: it has a source location.)
|
|
71
71
|
metric_rb, = Metric.instance_method(:details).source_location #: [String, Integer]
|
|
@@ -97,9 +97,9 @@ module Duel
|
|
|
97
97
|
|
|
98
98
|
# The metric: the objects alive after the sample less those before
|
|
99
99
|
# it (fewer, when the sample let go of more than it kept). Duel takes
|
|
100
|
-
#
|
|
100
|
+
# its per_sample and per_iteration into account when it compares them.
|
|
101
101
|
class Objects < Metric
|
|
102
|
-
def self.measures = {"retained_objects" => {unit: %w[object objects],
|
|
102
|
+
def self.measures = {"retained_objects" => {unit: %w[object objects], per_sample: PER_SAMPLE, per_iteration: PER_ITERATION}}
|
|
103
103
|
|
|
104
104
|
# mutant:disable -- mutant runs on CRuby, where this is always true
|
|
105
105
|
def self.available? = RUBY_ENGINE == "ruby"
|
|
@@ -133,7 +133,7 @@ module Duel
|
|
|
133
133
|
|
|
134
134
|
# What the sample retained, an iteration, by class and where it was
|
|
135
135
|
# made (the SHOWN most), when it retained more than Duel lets through
|
|
136
|
-
# (its
|
|
136
|
+
# (its per_sample a sample, and its per_iteration an iteration, as
|
|
137
137
|
# configured): only then is it worth walking every live object for
|
|
138
138
|
# (Retained.traced). Nothing for one that retained less. Duel asks
|
|
139
139
|
# once, after the sample: the trace is cleared either way.
|
data/sig/duel/retained.rbs
CHANGED
|
@@ -4,14 +4,14 @@ module Duel
|
|
|
4
4
|
module Retained
|
|
5
5
|
VERSION: String
|
|
6
6
|
|
|
7
|
-
# The retained objects a sample is allowed (Duel's
|
|
7
|
+
# The retained objects a sample is allowed (Duel's per_sample) before
|
|
8
8
|
# any is counted against it.
|
|
9
|
-
|
|
9
|
+
PER_SAMPLE: Integer
|
|
10
10
|
|
|
11
11
|
# Retained objects per iteration that still aren't a regression.
|
|
12
|
-
|
|
12
|
+
PER_ITERATION: Float
|
|
13
13
|
|
|
14
|
-
# The kinds of object a sample that retained more than
|
|
14
|
+
# The kinds of object a sample that retained more than it's allowed
|
|
15
15
|
# shows, most first.
|
|
16
16
|
SHOWN: Integer
|
|
17
17
|
|
|
@@ -54,8 +54,8 @@ module Duel
|
|
|
54
54
|
def resume_sample: (Sample _sample) -> nil
|
|
55
55
|
|
|
56
56
|
# What the sample retained, an iteration, by class and where it was
|
|
57
|
-
# made, when it retained more than its
|
|
58
|
-
# through.
|
|
57
|
+
# made, when it retained more than its per_sample and per_iteration
|
|
58
|
+
# let through.
|
|
59
59
|
def details: () -> String?
|
|
60
60
|
end
|
|
61
61
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: duel-retained
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Erik Berlin
|
|
@@ -16,7 +16,7 @@ dependencies:
|
|
|
16
16
|
-
|
|
17
17
|
- ~>
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.3.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -24,7 +24,7 @@ dependencies:
|
|
|
24
24
|
-
|
|
25
25
|
- ~>
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version:
|
|
27
|
+
version: 0.3.0
|
|
28
28
|
description: "A Duel plugin: every benchmark is judged on the Ruby objects its iterations leave alive after a full garbage collection, so a leak, or a cache that grows with every call, fails."
|
|
29
29
|
email:
|
|
30
30
|
- sferik@gmail.com
|