duel 0.3.0 → 0.3.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 +4 -4
- data/AGENT_PROMPT.md +47 -28
- data/CHANGELOG.md +58 -1
- data/README.md +2 -0
- data/docs/ci.md +23 -17
- data/docs/json.md +2 -2
- data/docs/plugins.md +10 -0
- data/lib/duel/baseline.rb +20 -2
- data/lib/duel/config.rb +13 -0
- data/lib/duel/init.rb +17 -0
- data/lib/duel/runner.rb +39 -9
- data/lib/duel/templates/duel.rb.erb +2 -2
- data/lib/duel/templates/perf-caller.yml.erb +1 -1
- data/lib/duel/templates/perf-comment-caller.yml.erb +16 -0
- data/lib/duel/templates/perf-comment.yml.erb +12 -0
- data/lib/duel/templates/perf-push-jobs.yml.erb +1 -1
- data/lib/duel/templates/perf.yml.erb +1 -1
- data/lib/duel/version.rb +1 -1
- data/lib/duel.rb +10 -0
- data/sig/duel/baseline.rbs +7 -0
- data/sig/duel/config.rbs +4 -0
- data/sig/duel/init.rbs +10 -0
- data/sig/duel/runner.rbs +15 -1
- data/sig/duel.rbs +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23f396423cb4db8062b811f884cd05a39916b8e543c7fba568a800ca64738ce3
|
|
4
|
+
data.tar.gz: 8d58f21ef14e30ac308a844f5c0086897284cc4fdcc7aa454660e61e6bea94bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 731f125fcd48ee615be492cce7a6eed473881d9dfcbb1dd49fcb46e95c60756b35cae5b8487b63fe31cb68ee39cf0a4352f78a7e70d9aac78b2d140c45c14f35
|
|
7
|
+
data.tar.gz: 1eaa6be76ec9b56f4a90bbd6cd5080059ba86b3faf22a4e836f8cb8c947e65fd4309a58d7e5aacc6d0c77478344d2f7a7d0216d4e66a1b08222c88a0b83dcd55
|
data/AGENT_PROMPT.md
CHANGED
|
@@ -16,13 +16,14 @@ at the API.
|
|
|
16
16
|
1. **Install and set up.** Add `gem "duel"` to the Gemfile's
|
|
17
17
|
development group (unless the Gemfile has it already), and run
|
|
18
18
|
`bundle install`. Then, unless the project is a Rails app (see step
|
|
19
|
-
4), run `bundle exec duel init
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
4), run `bundle exec duel init --badge` (or, if the project's README
|
|
20
|
+
shows no badges, without `--badge`: see step 7), and read what it
|
|
21
|
+
wrote: `.duel.rb`, an example benchmark in `duel/`, two GitHub
|
|
22
|
+
Actions workflows (`.github/workflows/perf.yml`, and
|
|
23
|
+
`perf-comment.yml`, which comments on pull requests), Duel's Rake
|
|
24
|
+
task, if there's a Rakefile, and `gem "stackprof", platforms: :mri`
|
|
25
|
+
in the Gemfile, for profiles of regressions. It lists what it did and
|
|
26
|
+
what's next: run `bundle install` again for StackProf.
|
|
26
27
|
|
|
27
28
|
2. **Find what's worth guarding.** Read the code and its tests to find
|
|
28
29
|
the work users depend on being fast:
|
|
@@ -110,9 +111,10 @@ at the API.
|
|
|
110
111
|
|
|
111
112
|
If the project is a Rails app, use duel-rails instead of `duel init`
|
|
112
113
|
(which says so) or setting Duel up by hand: add it to the Gemfile's
|
|
113
|
-
development group, run `bin/rails generate duel:install
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
development group, run `bin/rails generate duel:install --badge` (or
|
|
115
|
+
without `--badge`, as for `duel init`), read what it made, and run
|
|
116
|
+
`bundle install` again for what it added to the Gemfile (StackProf,
|
|
117
|
+
and a database server's plugin). Then:
|
|
116
118
|
- Benchmark the requests that matter most with `duel_request`, not
|
|
117
119
|
only the GET routes the generator found: the pages users load
|
|
118
120
|
most, and the forms and API calls that write. Give each request
|
|
@@ -206,13 +208,14 @@ at the API.
|
|
|
206
208
|
`.duel.rb` chooses when, and Duel also adds the report to the
|
|
207
209
|
job's summary). It runs none of the pull request's code. Keep it as
|
|
208
210
|
it is.
|
|
209
|
-
- The
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
- The `push` job's comment on a pushed commit, and its
|
|
212
|
+
`duel/passed/` branch that marks the last commit Duel passed, run
|
|
213
|
+
only where `.duel.rb` sets `c.fail_on = :pull_requests` or
|
|
214
|
+
`c.push_base = :last_passed`. Each writes to the repository, so
|
|
215
|
+
don't set those settings unless I ask. With `--badge`, it also
|
|
216
|
+
keeps Duel's badge, after each push to the default branch that
|
|
217
|
+
Duel compares, on a branch of its own (`duel/badge`, or for a
|
|
218
|
+
project in a subdirectory, `duel/badge-<its path>`).
|
|
216
219
|
|
|
217
220
|
Check that `ruby-version` is one the project supports, unless it has
|
|
218
221
|
a `.ruby-version`. Give the project's other CI setup that its tests
|
|
@@ -234,20 +237,34 @@ at the API.
|
|
|
234
237
|
|
|
235
238
|
7. **Show the badge.** If the project's README already shows badges (CI
|
|
236
239
|
status, gem version), add Duel's to that row, with exactly this
|
|
237
|
-
markdown, `OWNER/REPO` the project's repository
|
|
238
|
-
the
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
markdown, `OWNER/REPO` the project's repository. The badge is the one
|
|
241
|
+
the `push` job keeps (step 6): it turns red when Duel fails a push to
|
|
242
|
+
the default branch. It links to the Perf workflow's runs, which say
|
|
243
|
+
why:
|
|
244
|
+
|
|
245
|
+
```markdown
|
|
246
|
+
[](https://github.com/OWNER/REPO/actions/workflows/perf.yml)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
For a project in a subdirectory of its repository, the badge's
|
|
250
|
+
branch is `duel/badge-<its path>` in place of `duel/badge`, and the
|
|
251
|
+
workflow `perf-<its path>.yml` in place of `perf.yml`, as `duel init`
|
|
252
|
+
named them (`duel/badge-gems-parser` and `perf-gems-parser.yml` for
|
|
253
|
+
`gems/parser`, say). The branch doesn't exist until the first push to
|
|
254
|
+
the default branch that Duel compares, so until then, the badge
|
|
255
|
+
shows no image: say so when you report back.
|
|
256
|
+
|
|
257
|
+
Where there's no job to keep the badge (on GitLab CI, or where the
|
|
258
|
+
workflow doesn't run for pushes to the default branch), use Duel's
|
|
259
|
+
own badge, which is always green, linked the same way (on GitLab CI,
|
|
260
|
+
to `https://gitlab.com/OWNER/REPO/-/pipelines`):
|
|
242
261
|
|
|
243
262
|
```markdown
|
|
244
263
|
[](https://github.com/OWNER/REPO/actions/workflows/perf.yml)
|
|
245
264
|
```
|
|
246
265
|
|
|
247
|
-
If the README has no badges, don't add a row just for Duel's
|
|
248
|
-
|
|
249
|
-
needs the badge's job (`duel init --badge`), so add that only if I
|
|
250
|
-
ask.
|
|
266
|
+
If the README has no badges, don't add a row just for Duel's, and
|
|
267
|
+
leave out `--badge` (step 1), as nothing would show the badge.
|
|
251
268
|
|
|
252
269
|
8. **Report back** with:
|
|
253
270
|
- The benchmarks you wrote and what each one guards.
|
|
@@ -257,8 +274,10 @@ at the API.
|
|
|
257
274
|
- Anything you couldn't guard reliably.
|
|
258
275
|
- Every file you changed outside `duel/` and `.duel.rb`, and why.
|
|
259
276
|
- The label that lets a pull request that's slower on purpose pass
|
|
260
|
-
(`c.accept_label`, `duel: accept`
|
|
261
|
-
|
|
277
|
+
(`c.accept_label`, `duel: accept` by default), which the
|
|
278
|
+
repository needs to have.
|
|
279
|
+
- Whether the README's badge shows yet: the one that turns red
|
|
280
|
+
shows once the first push to the default branch has run.
|
|
262
281
|
|
|
263
282
|
9. **Add the project to Duel's list.** If the project's repository is
|
|
264
283
|
public, open a pull request in Duel's repository
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-11-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- A plugin can say how many workers' resources the machine has room
|
|
15
|
+
for at once, counting each version's, as its module's `worker_limit`
|
|
16
|
+
(or `nil` for no limit), where they take something there's only so
|
|
17
|
+
much of: a postgres's System V shared memory segment, say, which
|
|
18
|
+
macOS allows 32 of in all. Duel runs no more workers at once than the
|
|
19
|
+
fewest any plugin used says: it runs fewer benchmarks at a time, and
|
|
20
|
+
then fewer workers of each version, as it does to fit the memory
|
|
21
|
+
available, and says so ("Its plugins' resources allow 16 workers at
|
|
22
|
+
once, as they say, so to fit: ..."), even where it can't tell the
|
|
23
|
+
memory available. Where the `--jobs` and `--processes` (or
|
|
24
|
+
`c.processes`) given would run more, it fails before starting any,
|
|
25
|
+
saying how many they'd run and how many fit.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- AGENT_PROMPT.md has the agent set up the badge that turns red when
|
|
30
|
+
Duel fails a push to the default branch, by default: it runs
|
|
31
|
+
`duel init --badge` (or `bin/rails generate duel:install --badge`)
|
|
32
|
+
and shows that badge in the README, linked to the Perf workflow's
|
|
33
|
+
runs. It shows Duel's own badge, which is always green, only where
|
|
34
|
+
there's no job to keep one (on GitLab CI, or where the workflow
|
|
35
|
+
doesn't run for pushes), and leaves out the badge's job where the
|
|
36
|
+
README shows no badges. Its step about the workflow's jobs for
|
|
37
|
+
pushes describes them as Duel 0.3.0 writes them.
|
|
38
|
+
- The Perf comment workflow that `duel init` writes has a concurrency
|
|
39
|
+
group, as linters of workflows such as jactionlint ask for: each Perf
|
|
40
|
+
run's report has a run of its own, which nothing cancels, and a pull
|
|
41
|
+
request's label changes run in turn. The workflow that calls Duel's
|
|
42
|
+
reusable one names its group with `-caller`, apart from any of the
|
|
43
|
+
workflow it calls, where `github.workflow` is the caller's name too.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- A baseline checked out and built by an earlier run is built afresh
|
|
48
|
+
where the Ruby running Duel changed since (a new patch release, say),
|
|
49
|
+
rather than measured with a C extension built for the other Ruby,
|
|
50
|
+
which can fail to load ("Library not loaded: .../libruby.3.4.dylib")
|
|
51
|
+
or measure the wrong code: `rake compile` doesn't redo a build when
|
|
52
|
+
nothing it's built from changed. A baseline whose build failed is
|
|
53
|
+
built afresh on the next run too, not measured as it was left. Duel
|
|
54
|
+
keeps what built the checkout (its commit, and the Ruby) in
|
|
55
|
+
`tmp/duel`, which `duel clean` removes with the checkout.
|
|
56
|
+
- `duel init` writes the workflow's push trigger for the project's
|
|
57
|
+
default branch: `.duel.rb`'s `c.main_branch`, the branch origin's
|
|
58
|
+
HEAD names (the repository's default, in a clone of it), or else
|
|
59
|
+
`main`, or `master`, whichever is there. It wrote `main` whatever
|
|
60
|
+
the repository's was, so a project whose default branch is `master`
|
|
61
|
+
ran Duel on no push until its workflow was changed by hand. The
|
|
62
|
+
comment on moving the passed branch names it too, and so do the
|
|
63
|
+
comments of the `.duel.rb` it writes on `c.fail_on` and
|
|
64
|
+
`c.push_base`.
|
|
65
|
+
|
|
10
66
|
## [0.3.0] - 2026-11-20
|
|
11
67
|
|
|
12
68
|
### Added
|
|
@@ -1151,7 +1207,8 @@ needs Ruby 3.4 or later (or JRuby 10, or TruffleRuby 40).
|
|
|
1151
1207
|
Anything marked `@api private`, in lib/ and sig/, may change in any
|
|
1152
1208
|
release.
|
|
1153
1209
|
|
|
1154
|
-
[Unreleased]: https://github.com/sferik/duel-ruby/compare/v0.3.
|
|
1210
|
+
[Unreleased]: https://github.com/sferik/duel-ruby/compare/v0.3.1...HEAD
|
|
1211
|
+
[0.3.1]: https://github.com/sferik/duel-ruby/compare/v0.3.0...v0.3.1
|
|
1155
1212
|
[0.3.0]: https://github.com/sferik/duel-ruby/compare/v0.2.0...v0.3.0
|
|
1156
1213
|
[0.2.0]: https://github.com/sferik/duel-ruby/compare/v0.1.8...v0.2.0
|
|
1157
1214
|
[0.1.8]: https://github.com/sferik/duel-ruby/compare/v0.1.7...v0.1.8
|
data/README.md
CHANGED
|
@@ -138,6 +138,8 @@ how to add Duel to your project. The agent does the following:
|
|
|
138
138
|
* Checks that the benchmarks pass against the unchanged code, and that
|
|
139
139
|
they catch a deliberate slowdown.
|
|
140
140
|
* Adds the CI workflow.
|
|
141
|
+
* Shows Duel's badge with the README's other badges, kept by a job of
|
|
142
|
+
the workflow that turns it red when Duel fails a push.
|
|
141
143
|
|
|
142
144
|
To use the prompt, paste it into the agent, or point the agent at the
|
|
143
145
|
file. The prompt also ships with the gem. After you install Duel, it's
|
data/docs/ci.md
CHANGED
|
@@ -171,7 +171,7 @@ jobs:
|
|
|
171
171
|
DUEL_COMMENT: ${{ needs.duel.outputs.comment }}
|
|
172
172
|
DUEL_STATUS: ${{ needs.duel.outputs.status }}
|
|
173
173
|
run: |
|
|
174
|
-
gem install duel --version '0.3.
|
|
174
|
+
gem install duel --version '0.3.1' --no-document
|
|
175
175
|
duel comment --report "$RUNNER_TEMP/report" --commit "$GITHUB_SHA" --marker 'duel'
|
|
176
176
|
|
|
177
177
|
# With c.push_base = :last_passed in .duel.rb, a push is compared with
|
|
@@ -206,7 +206,7 @@ jobs:
|
|
|
206
206
|
GH_TOKEN: ${{ github.token }}
|
|
207
207
|
BRANCH: ${{ needs.duel.outputs.passed }}
|
|
208
208
|
run: |
|
|
209
|
-
gem install duel --version '0.3.
|
|
209
|
+
gem install duel --version '0.3.1' --no-document
|
|
210
210
|
duel mark-passed "$BRANCH"
|
|
211
211
|
```
|
|
212
212
|
|
|
@@ -343,6 +343,12 @@ on:
|
|
|
343
343
|
pull_request_target:
|
|
344
344
|
types: [labeled, unlabeled]
|
|
345
345
|
|
|
346
|
+
# Each Perf run's report has a run of its own, which nothing cancels, and
|
|
347
|
+
# a pull request's label changes run in turn.
|
|
348
|
+
concurrency:
|
|
349
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.id }}
|
|
350
|
+
cancel-in-progress: false
|
|
351
|
+
|
|
346
352
|
permissions: {}
|
|
347
353
|
|
|
348
354
|
jobs:
|
|
@@ -375,7 +381,7 @@ jobs:
|
|
|
375
381
|
GH_TOKEN: ${{ github.token }}
|
|
376
382
|
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
377
383
|
run: |
|
|
378
|
-
gem install duel --version '0.3.
|
|
384
|
+
gem install duel --version '0.3.1' --no-document
|
|
379
385
|
duel comment --report "$RUNNER_TEMP/report" --head "$HEAD_SHA" --marker 'duel'
|
|
380
386
|
|
|
381
387
|
again:
|
|
@@ -591,7 +597,7 @@ keeps `.duel.rb`), or add the job yourself:
|
|
|
591
597
|
RESULT: ${{ needs.duel.result }}
|
|
592
598
|
STATUS: ${{ needs.duel.outputs.status }}
|
|
593
599
|
run: |
|
|
594
|
-
gem install duel --version '0.3.
|
|
600
|
+
gem install duel --version '0.3.1' --no-document
|
|
595
601
|
duel badge duel/badge --status "$STATUS" --result "$RESULT"
|
|
596
602
|
```
|
|
597
603
|
|
|
@@ -648,7 +654,7 @@ Duel release you run it with, and pass on what your `.duel.rb` sets
|
|
|
648
654
|
# .github/workflows/perf.yml
|
|
649
655
|
jobs:
|
|
650
656
|
duel:
|
|
651
|
-
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.
|
|
657
|
+
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.1
|
|
652
658
|
permissions:
|
|
653
659
|
contents: read
|
|
654
660
|
pull-requests: read # for the pull request's labels (see c.accept_label)
|
|
@@ -657,7 +663,7 @@ jobs:
|
|
|
657
663
|
push:
|
|
658
664
|
needs: duel
|
|
659
665
|
if: ${{ !cancelled() && github.event_name == 'push' }}
|
|
660
|
-
uses: sferik/duel-ruby/.github/workflows/duel-push.yml@v0.3.
|
|
666
|
+
uses: sferik/duel-ruby/.github/workflows/duel-push.yml@v0.3.1
|
|
661
667
|
permissions:
|
|
662
668
|
contents: write # to comment on the commit, move the passed branch, and the badge's
|
|
663
669
|
with:
|
|
@@ -718,7 +724,7 @@ more than once, each call with a `report` of its own:
|
|
|
718
724
|
```yaml
|
|
719
725
|
jobs:
|
|
720
726
|
yjit:
|
|
721
|
-
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.
|
|
727
|
+
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.1
|
|
722
728
|
permissions:
|
|
723
729
|
contents: read
|
|
724
730
|
pull-requests: read
|
|
@@ -726,7 +732,7 @@ jobs:
|
|
|
726
732
|
jit: yjit
|
|
727
733
|
report: yjit
|
|
728
734
|
zjit:
|
|
729
|
-
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.
|
|
735
|
+
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.1
|
|
730
736
|
permissions:
|
|
731
737
|
contents: read
|
|
732
738
|
pull-requests: read
|
|
@@ -735,7 +741,7 @@ jobs:
|
|
|
735
741
|
jit: zjit
|
|
736
742
|
report: zjit
|
|
737
743
|
interpreter:
|
|
738
|
-
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.
|
|
744
|
+
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.1
|
|
739
745
|
permissions:
|
|
740
746
|
contents: read
|
|
741
747
|
pull-requests: read
|
|
@@ -754,7 +760,7 @@ it said and its `report`:
|
|
|
754
760
|
yjit-push:
|
|
755
761
|
needs: yjit
|
|
756
762
|
if: ${{ !cancelled() && github.event_name == 'push' }}
|
|
757
|
-
uses: sferik/duel-ruby/.github/workflows/duel-push.yml@v0.3.
|
|
763
|
+
uses: sferik/duel-ruby/.github/workflows/duel-push.yml@v0.3.1
|
|
758
764
|
permissions:
|
|
759
765
|
contents: write
|
|
760
766
|
with:
|
|
@@ -784,14 +790,14 @@ for Windows next to the one for Linux, say:
|
|
|
784
790
|
```yaml
|
|
785
791
|
jobs:
|
|
786
792
|
linux:
|
|
787
|
-
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.
|
|
793
|
+
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.1
|
|
788
794
|
permissions:
|
|
789
795
|
contents: read
|
|
790
796
|
pull-requests: read
|
|
791
797
|
with:
|
|
792
798
|
report: linux
|
|
793
799
|
windows:
|
|
794
|
-
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.
|
|
800
|
+
uses: sferik/duel-ruby/.github/workflows/duel.yml@v0.3.1
|
|
795
801
|
permissions:
|
|
796
802
|
contents: read
|
|
797
803
|
pull-requests: read
|
|
@@ -832,13 +838,13 @@ A tag can be moved, so you can name the commit it's at instead, with
|
|
|
832
838
|
the tag beside it, as Dependabot keeps them:
|
|
833
839
|
|
|
834
840
|
```yaml
|
|
835
|
-
uses: sferik/duel-ruby/.github/workflows/duel.yml@<commit> # v0.3.
|
|
841
|
+
uses: sferik/duel-ruby/.github/workflows/duel.yml@<commit> # v0.3.1
|
|
836
842
|
```
|
|
837
843
|
|
|
838
844
|
Duel's workflows, the reusable ones and those `duel init` writes, name
|
|
839
845
|
each action they use by its commit too, and the jobs that write to the
|
|
840
846
|
repository (or comment) install exactly the release of Duel that wrote
|
|
841
|
-
them (`gem install duel --version '0.3.
|
|
847
|
+
them (`gem install duel --version '0.3.1'`), not the newest one.
|
|
842
848
|
|
|
843
849
|
## Run Duel on GitLab CI
|
|
844
850
|
|
|
@@ -977,7 +983,7 @@ duel:comment:
|
|
|
977
983
|
variables:
|
|
978
984
|
GIT_STRATEGY: none # it runs none of the code
|
|
979
985
|
script:
|
|
980
|
-
- gem install duel --version '0.3.
|
|
986
|
+
- gem install duel --version '0.3.1' --no-document
|
|
981
987
|
# (The merge request's head: in a merged results pipeline, not the
|
|
982
988
|
# commit that merges it.)
|
|
983
989
|
- duel comment --report . --head "${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}" --marker 'duel'
|
|
@@ -997,7 +1003,7 @@ duel:commit-comment:
|
|
|
997
1003
|
variables:
|
|
998
1004
|
GIT_STRATEGY: none # it runs none of the code
|
|
999
1005
|
script:
|
|
1000
|
-
- gem install duel --version '0.3.
|
|
1006
|
+
- gem install duel --version '0.3.1' --no-document
|
|
1001
1007
|
- duel comment --report . --commit "$CI_COMMIT_SHA" --marker 'duel'
|
|
1002
1008
|
|
|
1003
1009
|
# With c.push_base = :last_passed in .duel.rb, a push is compared with the
|
|
@@ -1021,7 +1027,7 @@ duel:passed:
|
|
|
1021
1027
|
GIT_STRATEGY: none # it runs none of the code
|
|
1022
1028
|
script:
|
|
1023
1029
|
- '[ -n "$DUEL_PASSED" ] || exit 0'
|
|
1024
|
-
- gem install duel --version '0.3.
|
|
1030
|
+
- gem install duel --version '0.3.1' --no-document
|
|
1025
1031
|
- duel mark-passed "$DUEL_PASSED"
|
|
1026
1032
|
```
|
|
1027
1033
|
|
data/docs/json.md
CHANGED
|
@@ -43,7 +43,7 @@ A run that found one regression, abridged to two benchmarks:
|
|
|
43
43
|
```json
|
|
44
44
|
{
|
|
45
45
|
"schema": 2,
|
|
46
|
-
"duel_version": "0.3.
|
|
46
|
+
"duel_version": "0.3.1",
|
|
47
47
|
"status": "failed",
|
|
48
48
|
"exit": 1,
|
|
49
49
|
"passed_anyway": null,
|
|
@@ -189,7 +189,7 @@ A run with nothing to compare has the same keys, with nothing compared:
|
|
|
189
189
|
```json
|
|
190
190
|
{
|
|
191
191
|
"schema": 2,
|
|
192
|
-
"duel_version": "0.3.
|
|
192
|
+
"duel_version": "0.3.1",
|
|
193
193
|
"status": "nothing_to_compare",
|
|
194
194
|
"exit": 0,
|
|
195
195
|
"passed_anyway": null,
|
data/docs/plugins.md
CHANGED
|
@@ -84,6 +84,16 @@ When you write a plugin, follow these guidelines:
|
|
|
84
84
|
memory available by what one of each version takes as it starts, and
|
|
85
85
|
a server takes more as it's used, so Duel counts at least this much
|
|
86
86
|
for each worker. A version of Duel before 0.1.8 ignores it.
|
|
87
|
+
- If what each worker's `c.prepare(:worker)` starts takes something the
|
|
88
|
+
machine has only so much of, such as a System V shared memory segment
|
|
89
|
+
for a postgres (macOS allows 32 in all), say how many workers' it has
|
|
90
|
+
room for at once, counting each version's, as the module's
|
|
91
|
+
`worker_limit`, or `nil` for no limit, for example
|
|
92
|
+
`def self.worker_limit = 24`. Duel runs no more workers than that at
|
|
93
|
+
once, running fewer benchmarks at a time and then fewer workers of
|
|
94
|
+
each version, and fails, saying so, where `--jobs` and `--processes`
|
|
95
|
+
(or `c.processes`) given would run more. A version of Duel before
|
|
96
|
+
0.3.1 ignores it.
|
|
87
97
|
- If a worker's server listens on a Unix socket in `w.dir`, give the
|
|
88
98
|
plugin an option to listen on `w.free_port` instead, and default it to
|
|
89
99
|
where `Duel.unix_sockets?` is false, for example
|
data/lib/duel/baseline.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "digest"
|
|
4
4
|
require "fileutils"
|
|
5
5
|
require "open3"
|
|
6
|
+
require "rbconfig"
|
|
6
7
|
require_relative "../duel"
|
|
7
8
|
require_relative "rubies"
|
|
8
9
|
require_relative "spawn"
|
|
@@ -125,7 +126,12 @@ module Duel
|
|
|
125
126
|
(Config.list(@config.watch) + measured).uniq
|
|
126
127
|
end
|
|
127
128
|
|
|
128
|
-
# The baseline's tree, checked out and built if it's a commit.
|
|
129
|
+
# The baseline's tree, checked out and built if it's a commit. A
|
|
130
|
+
# checkout already there is kept only as what built it says
|
|
131
|
+
# (#built_by): of that commit, and where there's a build, by this
|
|
132
|
+
# Ruby. One a build failed in, or that another Ruby built (whose C
|
|
133
|
+
# extension the next build wouldn't redo, as nothing it's built from
|
|
134
|
+
# changed), is checked out and built afresh.
|
|
129
135
|
def root
|
|
130
136
|
base_dir = @settings.base_dir
|
|
131
137
|
return File.expand_path(base_dir) if base_dir
|
|
@@ -133,17 +139,29 @@ module Duel
|
|
|
133
139
|
sha = git("rev-parse", "#{ref}^{commit}")
|
|
134
140
|
dir = checkout
|
|
135
141
|
tree = within(dir)
|
|
136
|
-
|
|
142
|
+
built = File.join(@config.state, "base.built")
|
|
143
|
+
unless git("-C", dir, "rev-parse", "HEAD", allow_failure: true) == sha && File.exist?(built) && File.read(built) == built_by(sha)
|
|
137
144
|
FileUtils.rm_rf(dir)
|
|
138
145
|
git("worktree", "prune") # (git's record of it)
|
|
139
146
|
git("worktree", "add", dir, sha)
|
|
140
147
|
build(tree, "the baseline") if Dir.exist?(tree)
|
|
148
|
+
FileUtils.mkdir_p(@config.state)
|
|
149
|
+
File.write(built, built_by(sha))
|
|
141
150
|
end
|
|
142
151
|
raise Error, "the baseline (#{ref}) has no #{prefix}: compare with --base REF, a commit that has it" unless Dir.exist?(tree)
|
|
143
152
|
|
|
144
153
|
tree
|
|
145
154
|
end
|
|
146
155
|
|
|
156
|
+
# What built the baseline's checkout of +sha+ (see #root): the commit,
|
|
157
|
+
# and where there's a build, the Ruby it ran on (Duel's, whose bin
|
|
158
|
+
# Bundler and rbenv put first on the PATH).
|
|
159
|
+
def built_by(sha) = @config.build ? "#{sha}\n#{Baseline.ruby}" : sha
|
|
160
|
+
|
|
161
|
+
# The Ruby running Duel: its path and what it says it is, which a new
|
|
162
|
+
# patch release, or another Ruby of the same version, changes.
|
|
163
|
+
def self.ruby = "#{RbConfig.ruby} #{RUBY_DESCRIPTION}"
|
|
164
|
+
|
|
147
165
|
# Where the project is in a checkout of its repository at +dir+: as far
|
|
148
166
|
# from the top as it is in its own (a project in a subdirectory of a
|
|
149
167
|
# monorepo, say).
|
data/lib/duel/config.rb
CHANGED
|
@@ -491,6 +491,19 @@ module Duel
|
|
|
491
491
|
used.value
|
|
492
492
|
end
|
|
493
493
|
|
|
494
|
+
# The most workers whose resources can run at once, as the plugins
|
|
495
|
+
# used say (see Duel.plugin), counting each version's: the fewest any
|
|
496
|
+
# says, or nil where none does. Asked as the run fits its workers (see
|
|
497
|
+
# Runner#fit), not as .duel.rb loads, which each worker does too.
|
|
498
|
+
# @api private
|
|
499
|
+
def worker_limit
|
|
500
|
+
@used.each_key.filter_map do |name|
|
|
501
|
+
plugin = Duel.plugins.fetch(name)
|
|
502
|
+
limited = plugin #: Module & Duel::_Plugin & Duel::_WorkerLimit
|
|
503
|
+
limited.worker_limit if plugin.respond_to?(:worker_limit)
|
|
504
|
+
end.min
|
|
505
|
+
end
|
|
506
|
+
|
|
494
507
|
# The plugins used (see #use), by name, in the order they were first
|
|
495
508
|
# used.
|
|
496
509
|
def plugins = @used.keys
|
data/lib/duel/init.rb
CHANGED
|
@@ -402,6 +402,21 @@ module Duel
|
|
|
402
402
|
# none, where .ruby-version names it.
|
|
403
403
|
def ruby_version = (RUBY_VERSION[/\A\d+\.\d+/] unless version_file)
|
|
404
404
|
|
|
405
|
+
# The branch the workflow guards, as pushes to it run Duel: .duel.rb's
|
|
406
|
+
# c.main_branch, the branch origin's HEAD names (the repository's
|
|
407
|
+
# default, in a clone of it), or else main, or master, whichever is
|
|
408
|
+
# there, or main. (Asked once: the templates ask often.)
|
|
409
|
+
def default_branch
|
|
410
|
+
@default_branch ||= (settings || config).main_branch&.delete_prefix("origin/") ||
|
|
411
|
+
git_line("symbolic-ref", "--short", "refs/remotes/origin/HEAD")&.delete_prefix("origin/") ||
|
|
412
|
+
%w[main master].find { |branch| git_line("rev-parse", "--verify", "refs/heads/#{branch}") } || "main"
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
# What git printed in the project's directory, its first line, or nil
|
|
416
|
+
# where it printed nothing (as each of #default_branch's does where it
|
|
417
|
+
# fails, saying why on stderr).
|
|
418
|
+
def git_line(*args) = Spawn.open3(:capture3, "git", "-C", @root, *args).first.lines.first&.chomp
|
|
419
|
+
|
|
405
420
|
# The root of the project's git repository: the project's own
|
|
406
421
|
# directory, outside one. (Asked once: the templates ask often.)
|
|
407
422
|
def repository
|
|
@@ -492,6 +507,8 @@ module Duel
|
|
|
492
507
|
|
|
493
508
|
def badge_branch = "duel/badge"
|
|
494
509
|
|
|
510
|
+
def default_branch = "main"
|
|
511
|
+
|
|
495
512
|
def workflow_name = "perf.yml"
|
|
496
513
|
|
|
497
514
|
# Each in, run only where its input says to.
|
data/lib/duel/runner.rb
CHANGED
|
@@ -287,6 +287,13 @@ module Duel
|
|
|
287
287
|
# some 1.5 GB (and HEADROOM covers the rest).
|
|
288
288
|
JIT_GROWTH = {"truffleruby" => 2.5}.freeze
|
|
289
289
|
|
|
290
|
+
# Fits the run's workers in the memory available (#fit_memory), and in
|
|
291
|
+
# what the plugins' resources allow at once (#fit_limit).
|
|
292
|
+
def fit
|
|
293
|
+
fit_memory unless @settings.fit.empty?
|
|
294
|
+
fit_limit
|
|
295
|
+
end
|
|
296
|
+
|
|
290
297
|
# Lowers Settings#jobs, and then Settings#processes, as far as
|
|
291
298
|
# Settings#fit lets it, where their workers (and each one's
|
|
292
299
|
# resources, a database server, say) wouldn't fit in the memory
|
|
@@ -298,9 +305,7 @@ module Duel
|
|
|
298
305
|
# the plugins say each worker's resources take at most
|
|
299
306
|
# (Config#worker_memory), if that's more: a database server takes
|
|
300
307
|
# more as it's used.
|
|
301
|
-
def
|
|
302
|
-
return if @settings.fit.empty?
|
|
303
|
-
|
|
308
|
+
def fit_memory
|
|
304
309
|
available = Memory.available or return
|
|
305
310
|
taken = Lane.open(@config, @settings, @sides, processes: 1) { available - (Memory.available || available) }
|
|
306
311
|
said = 2 * @config.worker_memory
|
|
@@ -308,7 +313,36 @@ module Duel
|
|
|
308
313
|
pair = [(taken * HEADROOM * growth).ceil, said].max
|
|
309
314
|
return unless pair.positive?
|
|
310
315
|
|
|
311
|
-
|
|
316
|
+
fewer = lower([(available - RESERVE) / pair, 1].max) or return
|
|
317
|
+
takes = if said == pair then "#{gigabytes(said)} GB, with its resources, as its plugins say"
|
|
318
|
+
elsif growth > 1 then "#{gigabytes(taken)} GB, with its resources, as it starts, and some #{growth}x that once warm"
|
|
319
|
+
else "#{gigabytes(taken)} GB, with its resources"
|
|
320
|
+
end
|
|
321
|
+
@out.puts "A worker of each version takes #{takes}, of #{gigabytes(available)} GB available, so to fit: #{fewer}"
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# Lowers Settings#jobs, and then Settings#processes, as far as
|
|
325
|
+
# Settings#fit lets it, where more workers, each version's in every
|
|
326
|
+
# lane, would run at once than the plugins say their resources allow
|
|
327
|
+
# (Config#worker_limit): a postgres takes a System V shared memory
|
|
328
|
+
# segment, say, and macOS allows 32 in all, so a worker whose server
|
|
329
|
+
# can't make one fails as it starts. It fails where the settings given
|
|
330
|
+
# would run more anyway.
|
|
331
|
+
def fit_limit
|
|
332
|
+
limit = @config.worker_limit or return
|
|
333
|
+
fewer = lower([limit / 2, 1].max)
|
|
334
|
+
@out.puts "Its plugins' resources allow #{Runner.count(limit, "worker")} at once, as they say, so to fit: #{fewer}" if fewer
|
|
335
|
+
running = 2 * @settings.jobs * @settings.processes
|
|
336
|
+
return if running <= limit
|
|
337
|
+
|
|
338
|
+
raise Error, "#{@settings.jobs} at a time of #{Runner.count(@settings.processes, "worker")} of each version run #{running} workers " \
|
|
339
|
+
"at once, but its plugins' resources allow #{limit}, as they say: run fewer (--processes, DUEL_PROCESSES or c.processes, and --jobs)"
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Lowers Settings#jobs, and then Settings#processes, as far as
|
|
343
|
+
# Settings#fit lets it, to run +pairs+ workers of each version at once
|
|
344
|
+
# at most. Says what it lowered, or nil where it lowered nothing.
|
|
345
|
+
def lower(pairs)
|
|
312
346
|
processes = @settings.fit.include?(:processes) ? [@settings.processes, pairs].min : @settings.processes
|
|
313
347
|
# (More jobs than the settings' are never taken: only fewer are.)
|
|
314
348
|
jobs = @settings.fit.include?(:jobs) ? [pairs / processes, 1].max : @settings.jobs
|
|
@@ -316,13 +350,9 @@ module Duel
|
|
|
316
350
|
("#{Runner.count(processes, "worker")} of each version (not #{@settings.processes})" if processes < @settings.processes)].compact
|
|
317
351
|
return if fewer.empty?
|
|
318
352
|
|
|
319
|
-
takes = if said == pair then "#{gigabytes(said)} GB, with its resources, as its plugins say"
|
|
320
|
-
elsif growth > 1 then "#{gigabytes(taken)} GB, with its resources, as it starts, and some #{growth}x that once warm"
|
|
321
|
-
else "#{gigabytes(taken)} GB, with its resources"
|
|
322
|
-
end
|
|
323
|
-
@out.puts "A worker of each version takes #{takes}, of #{gigabytes(available)} GB available, so to fit: #{fewer.join(", and ")}"
|
|
324
353
|
@settings.jobs = jobs
|
|
325
354
|
@settings.processes = processes
|
|
355
|
+
fewer.join(", and ")
|
|
326
356
|
end
|
|
327
357
|
|
|
328
358
|
# +bytes+ in gigabytes, to a tenth.
|
|
@@ -40,7 +40,7 @@ Duel.configure do |c|
|
|
|
40
40
|
# c.comment = :failures
|
|
41
41
|
|
|
42
42
|
# Which runs a regression fails: :every_run, or :pull_requests, for a
|
|
43
|
-
# project where people push to
|
|
43
|
+
# project where people push to <%= default_branch %> directly (on GitHub Actions, another
|
|
44
44
|
# run warns and passes, and a pushed commit gets the comment instead,
|
|
45
45
|
# from a workflow job that runs where this is set: see docs/ci.md).
|
|
46
46
|
# c.fail_on = :every_run
|
|
@@ -51,7 +51,7 @@ Duel.configure do |c|
|
|
|
51
51
|
|
|
52
52
|
# What the workflow compares a push with: :before (the commit before it),
|
|
53
53
|
# or :last_passed (the last commit Duel passed, which a branch,
|
|
54
|
-
#
|
|
54
|
+
# <%= passed_branch %>/<%= default_branch %>, marks), so small slowdowns add up until they fail.
|
|
55
55
|
# (A workflow job moves the branch where this is set: see docs/ci.md.)
|
|
56
56
|
# c.push_base = :before
|
|
57
57
|
end
|
|
@@ -10,7 +10,7 @@ on:
|
|
|
10
10
|
pull_request:
|
|
11
11
|
merge_group: # (a merge queue's)
|
|
12
12
|
push:
|
|
13
|
-
branches: [
|
|
13
|
+
branches: [<%= default_branch %>] # (and any other branch to guard, a stable one, say)
|
|
14
14
|
schedule:
|
|
15
15
|
- cron: "0 4 * * *"
|
|
16
16
|
workflow_dispatch:
|
|
@@ -22,6 +22,22 @@ on:
|
|
|
22
22
|
types: [labeled, unlabeled]
|
|
23
23
|
<% end -%>
|
|
24
24
|
|
|
25
|
+
<% if accept_label -%>
|
|
26
|
+
# Each Perf run's report has a run of its own, which nothing cancels, and
|
|
27
|
+
# a pull request's label changes run in turn. (The group's -caller keeps
|
|
28
|
+
# it apart from any of the workflow it calls, where github.workflow is
|
|
29
|
+
# this one's name too.)
|
|
30
|
+
concurrency:
|
|
31
|
+
group: ${{ github.workflow }}-caller-${{ github.event.pull_request.number || github.event.workflow_run.id }}
|
|
32
|
+
<% else -%>
|
|
33
|
+
# Each Perf run's report has a run of its own, which nothing cancels.
|
|
34
|
+
# (The group's -caller keeps it apart from any of the workflow it calls,
|
|
35
|
+
# where github.workflow is this one's name too.)
|
|
36
|
+
concurrency:
|
|
37
|
+
group: ${{ github.workflow }}-caller-${{ github.event.workflow_run.id }}
|
|
38
|
+
<% end -%>
|
|
39
|
+
cancel-in-progress: false
|
|
40
|
+
|
|
25
41
|
permissions: {}
|
|
26
42
|
|
|
27
43
|
jobs:
|
|
@@ -62,6 +62,18 @@ on:
|
|
|
62
62
|
types: [labeled, unlabeled]
|
|
63
63
|
<% end -%>
|
|
64
64
|
|
|
65
|
+
<% if accept_label -%>
|
|
66
|
+
# Each Perf run's report has a run of its own, which nothing cancels, and
|
|
67
|
+
# a pull request's label changes run in turn.
|
|
68
|
+
concurrency:
|
|
69
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.id }}
|
|
70
|
+
<% else -%>
|
|
71
|
+
# Each Perf run's report has a run of its own, which nothing cancels.
|
|
72
|
+
concurrency:
|
|
73
|
+
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
|
|
74
|
+
<% end -%>
|
|
75
|
+
cancel-in-progress: false
|
|
76
|
+
|
|
65
77
|
<% end -%>
|
|
66
78
|
permissions: {}
|
|
67
79
|
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
# a push that passed (or makes it), but never back: where a newer
|
|
46
46
|
# push's run moved it first, it stays. It checks nothing out and runs
|
|
47
47
|
# none of the code. To accept a regression, move the branch yourself
|
|
48
|
-
# (for
|
|
48
|
+
# (for <%= default_branch %>, git push origin <%= default_branch %>:<%= passed_branch %>/<%= default_branch %>).
|
|
49
49
|
passed:
|
|
50
50
|
name: Mark the commit passed
|
|
51
51
|
needs: duel
|
|
@@ -78,7 +78,7 @@ on:
|
|
|
78
78
|
pull_request:
|
|
79
79
|
merge_group: # (a merge queue's)
|
|
80
80
|
push:
|
|
81
|
-
branches: [
|
|
81
|
+
branches: [<%= default_branch %>] # (and any other branch to guard, a stable one, say)
|
|
82
82
|
schedule:
|
|
83
83
|
- cron: "0 4 * * *"
|
|
84
84
|
workflow_dispatch:
|
data/lib/duel/version.rb
CHANGED
data/lib/duel.rb
CHANGED
|
@@ -231,6 +231,16 @@ module Duel
|
|
|
231
231
|
#
|
|
232
232
|
# def self.worker_memory = 450 << 20
|
|
233
233
|
#
|
|
234
|
+
# Where what it starts for each worker takes something the machine has
|
|
235
|
+
# only so much of (a System V shared memory segment, for a postgres:
|
|
236
|
+
# macOS allows 32 in all), it says how many workers' it has room for
|
|
237
|
+
# at once, counting each version's, as +worker_limit+, or nil for no
|
|
238
|
+
# limit: Runner#fit runs no more than that, and fails where the
|
|
239
|
+
# settings given would. (A version of Duel before it asked ignores
|
|
240
|
+
# it.)
|
|
241
|
+
#
|
|
242
|
+
# def self.worker_limit = 24
|
|
243
|
+
#
|
|
234
244
|
# Its own kinds of benchmark, if it has any, are the methods of its
|
|
235
245
|
# module's DSL module, which files of benchmarks get as .duel.rb uses
|
|
236
246
|
# it (see DSL.add):
|
data/sig/duel/baseline.rbs
CHANGED
|
@@ -52,6 +52,13 @@ module Duel
|
|
|
52
52
|
# The baseline's tree, checked out and built if it's a commit.
|
|
53
53
|
def root: () -> String
|
|
54
54
|
|
|
55
|
+
# What built the baseline's checkout of +sha+: the commit, and where
|
|
56
|
+
# there's a build, the Ruby it ran on.
|
|
57
|
+
def built_by: (String sha) -> String
|
|
58
|
+
|
|
59
|
+
# The Ruby running Duel: its path and what it says it is.
|
|
60
|
+
def self.ruby: () -> String
|
|
61
|
+
|
|
55
62
|
# Where the project is in a checkout of its repository at +dir+.
|
|
56
63
|
def within: (String dir) -> String
|
|
57
64
|
|
data/sig/duel/config.rbs
CHANGED
|
@@ -221,6 +221,10 @@ module Duel
|
|
|
221
221
|
# most, as they say, in bytes.
|
|
222
222
|
attr_reader worker_memory: Integer
|
|
223
223
|
|
|
224
|
+
# The most workers whose resources can run at once, as the plugins
|
|
225
|
+
# used say: the fewest any says, or nil where none does.
|
|
226
|
+
def worker_limit: () -> Integer?
|
|
227
|
+
|
|
224
228
|
# A configuration of the conventions, for the project at +root+.
|
|
225
229
|
def initialize: (?String root) -> void
|
|
226
230
|
|
data/sig/duel/init.rbs
CHANGED
|
@@ -30,6 +30,7 @@ module Duel
|
|
|
30
30
|
|
|
31
31
|
@argv: Array[String]
|
|
32
32
|
@repository: String?
|
|
33
|
+
@default_branch: String?
|
|
33
34
|
@out: _Output
|
|
34
35
|
@err: _Output
|
|
35
36
|
@input: _Input
|
|
@@ -157,6 +158,13 @@ module Duel
|
|
|
157
158
|
# The Ruby the workflow sets up, or none.
|
|
158
159
|
def ruby_version: () -> String?
|
|
159
160
|
|
|
161
|
+
# The branch the workflow guards: .duel.rb's c.main_branch, origin's
|
|
162
|
+
# HEAD, or else main, or master, whichever is there, or main.
|
|
163
|
+
def default_branch: () -> String
|
|
164
|
+
|
|
165
|
+
# What git printed in the project's directory, its first line, or nil.
|
|
166
|
+
def git_line: (*String args) -> String?
|
|
167
|
+
|
|
160
168
|
# The root of the project's git repository.
|
|
161
169
|
def repository: () -> String
|
|
162
170
|
|
|
@@ -210,6 +218,8 @@ module Duel
|
|
|
210
218
|
|
|
211
219
|
def badge_branch: () -> String
|
|
212
220
|
|
|
221
|
+
def default_branch: () -> String
|
|
222
|
+
|
|
213
223
|
def version_file: () -> true
|
|
214
224
|
|
|
215
225
|
def badge?: () -> true
|
data/sig/duel/runner.rbs
CHANGED
|
@@ -212,9 +212,23 @@ module Duel
|
|
|
212
212
|
# How many times a JIT engine's worker grows as it warms up.
|
|
213
213
|
JIT_GROWTH: Hash[String, Float]
|
|
214
214
|
|
|
215
|
+
# Fits the run's workers in the memory available, and in what the
|
|
216
|
+
# plugins' resources allow at once.
|
|
217
|
+
def fit: () -> void
|
|
218
|
+
|
|
215
219
|
# Lowers the jobs, then the processes, that Settings#fit lets it, to
|
|
216
220
|
# fit the memory available.
|
|
217
|
-
def
|
|
221
|
+
def fit_memory: () -> void
|
|
222
|
+
|
|
223
|
+
# Lowers the jobs, then the processes, that Settings#fit lets it, to
|
|
224
|
+
# run no more workers at once than the plugins' resources allow, and
|
|
225
|
+
# fails where the settings given would.
|
|
226
|
+
def fit_limit: () -> void
|
|
227
|
+
|
|
228
|
+
# Lowers the jobs, then the processes, that Settings#fit lets it, to
|
|
229
|
+
# run +pairs+ workers of each version at once at most: what it lowered,
|
|
230
|
+
# or nil.
|
|
231
|
+
def lower: (Integer pairs) -> String?
|
|
218
232
|
|
|
219
233
|
# +bytes+ in gigabytes, to a tenth.
|
|
220
234
|
def gigabytes: (Integer bytes) -> String
|
data/sig/duel.rbs
CHANGED
|
@@ -154,6 +154,12 @@ module Duel
|
|
|
154
154
|
def configure: (Config config, **untyped options) -> untyped
|
|
155
155
|
end
|
|
156
156
|
|
|
157
|
+
# A plugin that says how many workers' resources can run at once (see
|
|
158
|
+
# Duel.plugin), or nil for no limit.
|
|
159
|
+
interface _WorkerLimit
|
|
160
|
+
def worker_limit: () -> Integer?
|
|
161
|
+
end
|
|
162
|
+
|
|
157
163
|
# The configuration: the project's .duel.rb, or the conventions.
|
|
158
164
|
def self.config: () -> Config
|
|
159
165
|
|