duel-activerecord 0.1.8 → 0.2.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 +11 -1
- data/README.md +2 -2
- data/lib/duel/activerecord/version.rb +1 -1
- data/lib/duel/activerecord.rb +5 -3
- data/sig/duel/activerecord.rbs +1 -1
- metadata +59 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb15449c7e06c6b3b77d2d15198052ca86316e10f9541cf5b09d61360b01c437
|
|
4
|
+
data.tar.gz: cb38642c8fe9051c9efe71c65e6261883513886f379eb5ccd1f36bbdf0eabcd9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 022c13299725e473ecca919d122a71189d0a131ea84e5618b30b92f7e760fc416968e66d1b8325f503ab544cc25e7375eb07170622672108528afafd6589e7d7
|
|
7
|
+
data.tar.gz: cdc622c4f5c1ffb6cbb70d0378381414293f3cc4bb82d0f8e9c6f3cd8e0e9d53e9aaf29e04788362b2a2fc7cd5a05bd8b0b68607bb031190690192d522702e3a
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.0] - 2026-11-16
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- A regression's statements are shortened to 80 characters, ending in
|
|
15
|
+
`…`, as duel-mysql's and duel-postgresql's are, rather than 100
|
|
16
|
+
ending in `...`: where the plugins explain the same regression, their
|
|
17
|
+
statements read alike.
|
|
18
|
+
|
|
10
19
|
## [0.1.8] - 2026-11-12
|
|
11
20
|
|
|
12
21
|
No changes of its own: released in step with the other Duel gems.
|
|
@@ -64,7 +73,8 @@ and Ruby 3.4 or later (or JRuby 10, or TruffleRuby 40).
|
|
|
64
73
|
CI.
|
|
65
74
|
- RBS signatures in sig/, checked with Steep.
|
|
66
75
|
|
|
67
|
-
[Unreleased]: https://github.com/sferik/duel-ruby/compare/duel-activerecord-v0.
|
|
76
|
+
[Unreleased]: https://github.com/sferik/duel-ruby/compare/duel-activerecord-v0.2.0...HEAD
|
|
77
|
+
[0.2.0]: https://github.com/sferik/duel-ruby/compare/duel-activerecord-v0.1.8...duel-activerecord-v0.2.0
|
|
68
78
|
[0.1.8]: https://github.com/sferik/duel-ruby/compare/duel-activerecord-v0.1.7...duel-activerecord-v0.1.8
|
|
69
79
|
[0.1.7]: https://github.com/sferik/duel-ruby/compare/duel-activerecord-v0.1.6...duel-activerecord-v0.1.7
|
|
70
80
|
[0.1.6]: https://github.com/sferik/duel-ruby/compare/duel-activerecord-v0.1.5...duel-activerecord-v0.1.6
|
data/README.md
CHANGED
|
@@ -72,7 +72,7 @@ REGRESSION posts: the index page: worse instructions, cpu, active_record_queries
|
|
|
72
72
|
...
|
|
73
73
|
active_record_queries: 2 queries → 11 queries an iteration
|
|
74
74
|
active_record_queries (candidate): an iteration: 10× SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = ?; 1× SELECT "posts".* FROM "posts"
|
|
75
|
-
active_record_queries (baseline): an iteration: 1× SELECT "comments".* FROM "comments" WHERE "comments"."post_id" IN (?, ?, ?, ?,
|
|
75
|
+
active_record_queries (baseline): an iteration: 1× SELECT "comments".* FROM "comments" WHERE "comments"."post_id" IN (?, ?, ?, ?, …; 1× SELECT "posts".* FROM "posts"
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
> [!TIP]
|
|
@@ -123,7 +123,7 @@ explained (with [duel-retained](https://github.com/sferik/duel-ruby/tree/main/pl
|
|
|
123
123
|
that's within its allowance), and the rest are told as others. A regression
|
|
124
124
|
shows the three a sample sent most, and how many times an iteration
|
|
125
125
|
(and others'), of its last 1,000 queries, but those in `untimed` blocks,
|
|
126
|
-
with at most
|
|
126
|
+
with at most 80 characters of each.
|
|
127
127
|
|
|
128
128
|
`active_record_queries` counts what Rails' log counts as queries, but
|
|
129
129
|
leaves out cached ones, which never reach the database: they're
|
data/lib/duel/activerecord.rb
CHANGED
|
@@ -84,7 +84,7 @@ module Duel
|
|
|
84
84
|
|
|
85
85
|
# The most statements shown, and the most shown of each one's SQL.
|
|
86
86
|
SHOWN = 3
|
|
87
|
-
LENGTH =
|
|
87
|
+
LENGTH = 80
|
|
88
88
|
|
|
89
89
|
def initialize(query_time:, ignore:)
|
|
90
90
|
@query_time = query_time
|
|
@@ -176,10 +176,12 @@ module Duel
|
|
|
176
176
|
# The queries counted by a reading of the totals.
|
|
177
177
|
def queries(reading) = reading.total("active_record_queries")
|
|
178
178
|
|
|
179
|
-
# +sql+ on one line, and at most LENGTH long
|
|
179
|
+
# +sql+ on one line, and at most LENGTH long (with … where it's
|
|
180
|
+
# cut, in place: no other String is made for it).
|
|
180
181
|
def shorten(sql)
|
|
181
182
|
line = sql.gsub(/\s+/, " ").strip
|
|
182
|
-
|
|
183
|
+
line[LENGTH - 1, line.length] = "…" if line.length > LENGTH
|
|
184
|
+
line
|
|
183
185
|
end
|
|
184
186
|
|
|
185
187
|
def monotonic = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
|
data/sig/duel/activerecord.rbs
CHANGED
|
@@ -86,7 +86,7 @@ module Duel
|
|
|
86
86
|
# The queries counted by a reading of the totals.
|
|
87
87
|
def queries: (Snapshot::Reading[Integer, nil] reading) -> Integer
|
|
88
88
|
|
|
89
|
-
# +sql+ on one line, and at most LENGTH long.
|
|
89
|
+
# +sql+ on one line, and at most LENGTH long (with … where it's cut).
|
|
90
90
|
def shorten: (String sql) -> String
|
|
91
91
|
|
|
92
92
|
def monotonic: () -> Integer
|
metadata
CHANGED
|
@@ -1,81 +1,84 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: duel-activerecord
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Erik Berlin
|
|
7
|
+
- Erik Berlin
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- !ruby/object:Gem::
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: duel
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: "0.2"
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
-
|
|
25
|
+
- ~>
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: "0.2"
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: activerecord
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
-
|
|
33
|
+
- ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: "7.2"
|
|
36
|
+
type: :runtime
|
|
37
|
+
prerelease: false
|
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
-
|
|
41
|
+
- ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "7.2"
|
|
44
|
+
description: "A Duel plugin: every benchmark is judged on the SQL queries, cached queries, transactions and record instantiations Active Record did for it too, whatever the database."
|
|
43
45
|
email:
|
|
44
|
-
- sferik@gmail.com
|
|
46
|
+
- sferik@gmail.com
|
|
45
47
|
executables: []
|
|
46
48
|
extensions: []
|
|
47
49
|
extra_rdoc_files: []
|
|
48
50
|
files:
|
|
49
|
-
- CHANGELOG.md
|
|
50
|
-
- LICENSE
|
|
51
|
-
- README.md
|
|
52
|
-
- lib/duel/activerecord.rb
|
|
53
|
-
- lib/duel/activerecord/version.rb
|
|
54
|
-
- sig/duel/activerecord.rbs
|
|
55
|
-
homepage: https://github.com/sferik/duel-ruby/tree/main/plugins/activerecord
|
|
51
|
+
- CHANGELOG.md
|
|
52
|
+
- LICENSE
|
|
53
|
+
- README.md
|
|
54
|
+
- lib/duel/activerecord.rb
|
|
55
|
+
- lib/duel/activerecord/version.rb
|
|
56
|
+
- sig/duel/activerecord.rbs
|
|
57
|
+
homepage: "https://github.com/sferik/duel-ruby/tree/main/plugins/activerecord"
|
|
56
58
|
licenses:
|
|
57
|
-
- MIT
|
|
59
|
+
- MIT
|
|
58
60
|
metadata:
|
|
59
|
-
source_code_uri: https://github.com/sferik/duel-ruby/tree/main/plugins/activerecord
|
|
60
|
-
changelog_uri: https://github.com/sferik/duel-ruby/blob/main/plugins/activerecord/CHANGELOG.md
|
|
61
|
-
bug_tracker_uri: https://github.com/sferik/duel-ruby/issues
|
|
62
|
-
rubygems_mfa_required:
|
|
61
|
+
source_code_uri: "https://github.com/sferik/duel-ruby/tree/main/plugins/activerecord"
|
|
62
|
+
changelog_uri: "https://github.com/sferik/duel-ruby/blob/main/plugins/activerecord/CHANGELOG.md"
|
|
63
|
+
bug_tracker_uri: "https://github.com/sferik/duel-ruby/issues"
|
|
64
|
+
rubygems_mfa_required: "true"
|
|
63
65
|
rdoc_options: []
|
|
64
66
|
require_paths:
|
|
65
|
-
- lib
|
|
67
|
+
- lib
|
|
66
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
69
|
requirements:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
-
|
|
71
|
+
- ">="
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: "3.4"
|
|
71
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
75
|
requirements:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
-
|
|
77
|
+
- ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: "0"
|
|
76
80
|
requirements: []
|
|
77
|
-
rubygems_version: 4.0
|
|
81
|
+
rubygems_version: 4.1.0
|
|
78
82
|
specification_version: 4
|
|
79
|
-
summary:
|
|
80
|
-
records'
|
|
83
|
+
summary: "What Active Record did for each Duel benchmark: queries, transactions and records"
|
|
81
84
|
test_files: []
|