duel 0.1.1 → 0.1.3

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.
data/sig/duel/runner.rbs CHANGED
@@ -16,9 +16,13 @@ module Duel
16
16
  # @api private
17
17
  YJIT_WARM: Float
18
18
 
19
+ # The seconds a run measures for, at most, by default.
20
+ # @api private
21
+ TIME_LIMIT: Float
22
+
19
23
  # How a run is set up (see Duel::CLI for where each comes from).
20
24
  # @api private
21
- class Settings < Struct[String | Regexp | Integer | Float | bool | Config::ruby | Config::comment | nil]
25
+ class Settings < Struct[String | Regexp | Integer | Float | bool | Config::ruby | Config::comment | Config::fail_on | nil]
22
26
  attr_accessor base: String?
23
27
  attr_accessor base_dir: String?
24
28
  attr_accessor candidate_dir: String?
@@ -31,18 +35,32 @@ module Duel
31
35
  attr_accessor force: bool
32
36
  attr_accessor config_path: String?
33
37
  attr_accessor timeout: Float
38
+ # The seconds a run measures for, at most (--time-limit).
39
+ attr_accessor time_limit: Float
34
40
  # Each version's Ruby (--ruby), over Config#ruby.
35
41
  attr_accessor ruby: Config::ruby
36
42
  # When the workflow comments on a pull request (--comment), over
37
43
  # Config#comment.
38
44
  attr_accessor comment: Config::comment?
45
+ # Which runs a regression fails (--fail-on), over Config#fail_on.
46
+ attr_accessor fail_on: Config::fail_on?
47
+ # The branch pushed, where #base is the push's, the commit before it,
48
+ # on GitHub Actions (DUEL_BASE): see Baseline#ref.
49
+ attr_accessor pushed: String?
50
+ # The branch a pull request targets, on GitHub Actions
51
+ # (GITHUB_BASE_REF), on origin: see Baseline#main_branch.
52
+ attr_accessor target: String?
39
53
 
40
54
  def self.new: (?String? base, ?String? base_dir, ?String? candidate_dir, ?Regexp filter, ?Integer jobs,
41
55
  ?Integer processes, ?Float limit, ?Float confidence, ?Float? warm, ?bool force, ?String? config_path,
42
- ?Float timeout, ?Config::ruby ruby, ?Config::comment? comment) -> instance
56
+ ?Float timeout, ?Config::ruby ruby, ?Config::comment? comment,
57
+ ?Config::fail_on? fail_on, ?String? pushed,
58
+ ?String? target, ?Float time_limit) -> instance
43
59
  | (?base: String?, ?base_dir: String?, ?candidate_dir: String?, ?filter: Regexp, ?jobs: Integer,
44
60
  ?processes: Integer, ?limit: Float, ?confidence: Float, ?warm: Float?, ?force: bool,
45
- ?config_path: String?, ?timeout: Float, ?ruby: Config::ruby, ?comment: Config::comment?) -> instance
61
+ ?config_path: String?, ?timeout: Float, ?ruby: Config::ruby, ?comment: Config::comment?,
62
+ ?fail_on: Config::fail_on?, ?pushed: String?,
63
+ ?target: String?, ?time_limit: Float) -> instance
46
64
 
47
65
  def self.defaults: () -> Settings
48
66
  end
@@ -56,10 +74,17 @@ module Duel
56
74
  attr_accessor ruby: String
57
75
  attr_accessor env: Hash[String, String?]
58
76
 
77
+ # What each version's workers are named for: "base" and "head", as
78
+ # long as each other.
79
+ LABELS: Hash[String, String]
80
+
59
81
  def self.new: (String name, String root, String ruby, Hash[String, String?] env) -> instance
60
82
 
61
83
  # Each version with nothing prepared: its tree, on the runner's Ruby.
62
84
  def self.unprepared: (Config config, Settings settings, String base_root) -> Hash[String, Side]
85
+
86
+ # What its workers, and its version's resources, are named for.
87
+ def label: () -> String
63
88
  end
64
89
 
65
90
  # A worker process (Duel::Worker) running one version of the code.
@@ -464,6 +489,14 @@ module Duel
464
489
 
465
490
  @rubies: Hash[String, String]
466
491
  @seconds: Float
492
+ @lock: Thread::Mutex
493
+ @started: Float
494
+ @unmeasured: Array[String]
495
+ @unconfirmed: Array[String]
496
+ @across_cut: bool
497
+
498
+ # What a run cut short at its time limit left undone.
499
+ type cut_short = Hash[String, Array[String] | bool]
467
500
 
468
501
  # Across the board: {metric => verdict}. Set by #run.
469
502
  attr_reader across: Hash[String, Across::verdict]
@@ -474,6 +507,9 @@ module Duel
474
507
  # The seconds the run took. Set by #run.
475
508
  attr_reader seconds: Float
476
509
 
510
+ # What the run left undone when it reached its time limit, or nil.
511
+ def cut_short: () -> cut_short?
512
+
477
513
  def initialize: (Config config, Settings settings, String base_root, ?out: _Output) -> void
478
514
 
479
515
  # Returns the Results.
@@ -484,6 +520,12 @@ module Duel
484
520
 
485
521
  def regressed_across: () -> Array[String]
486
522
 
523
+ # What a run cut short at its time limit left undone, or nil.
524
+ def cut_short_note: () -> String?
525
+
526
+ # Whether the run has measured for longer than its time limit.
527
+ def out_of_time?: () -> bool
528
+
487
529
  # The plugins the configuration used, by name.
488
530
  def plugins: () -> Array[Symbol]
489
531
 
@@ -508,6 +550,11 @@ module Duel
508
550
 
509
551
  def attempt: (Lane lane, String name) -> Result
510
552
 
553
+ # A benchmark the run reached its time limit before it measured.
554
+ def unmeasured: (String name) -> Result
555
+
556
+ def limit_text: () -> String
557
+
511
558
  def confirm: (Array[Result] suspects) -> void
512
559
 
513
560
  def profile: (Array[Result] regressed) -> void
data/sig/duel/summary.rbs CHANGED
@@ -25,6 +25,7 @@ module Duel
25
25
  # How Duel decides that a timing is slower, in its docs.
26
26
  DECIDES: String
27
27
 
28
+ @note: String?
28
29
  @runner: Runner
29
30
  @results: Array[Result]
30
31
  @settings: Settings
@@ -51,7 +52,8 @@ module Duel
51
52
  # The counted measures that differ, an iteration.
52
53
  def self.changed_counts: (Result result) -> Hash[String, [Float, Float]]
53
54
 
54
- def initialize: (Runner runner, Array[Result] results, settings: Settings, baseline: String, candidate: String) -> void
55
+ def initialize: (Runner runner, Array[Result] results, settings: Settings, baseline: String, candidate: String,
56
+ ?note: String?) -> void
55
57
 
56
58
  # The Markdown.
57
59
  def markdown: () -> String
@@ -68,6 +70,9 @@ module Duel
68
70
  def compared: () -> String
69
71
 
70
72
  # The benchmarks that failed.
73
+ # What the run left undone at its time limit, if it reached it.
74
+ def cut_short: () -> String?
75
+
71
76
  def failures: () -> String?
72
77
 
73
78
  # What got worse, or the error's first line.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Berlin
@@ -68,7 +68,9 @@ files:
68
68
  - lib/duel/stats.rb
69
69
  - lib/duel/summary.rb
70
70
  - lib/duel/templates/benchmark_duel.rb.erb
71
+ - lib/duel/templates/duel.gitlab-ci.yml.erb
71
72
  - lib/duel/templates/duel.rb.erb
73
+ - lib/duel/templates/perf-comment.yml.erb
72
74
  - lib/duel/templates/perf.yml.erb
73
75
  - lib/duel/testing.rb
74
76
  - lib/duel/version.rb