rails_benchmark_suite 0.3.1 → 0.3.2

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: 473aa21869380dae81d4f9ee8668ccf161721923fd6c453cc711caf9d6303fd1
4
- data.tar.gz: 5101bb8d63885263dc3fcbb8851d52f3ed48a1f919b0abfab38d43dc3f3df2a2
3
+ metadata.gz: 52350ff4b60a92bb839f96eb8d5032df181fb8578c12ea72afd42ede82f89a43
4
+ data.tar.gz: 6191dfad41045b1b3035a4482a32aa1fc18b560d1b1903282081e28e400fe7c8
5
5
  SHA512:
6
- metadata.gz: 11311aa76df4c103c8b3ea2e12a803ddeb339cd454127b246557341ddd5c7872fa01c4ff00f4c14ae711d95b48f0d84b148ec7f8b0a39fda7ab70cac0d070bad
7
- data.tar.gz: 3f141277e2daae966aa4d7d7be684e112889fa757282e36a4f35ac34d60ac91ca76903281d9e091b9549ef567d6e8b7a26b13221326bf8273c3c33fe7e6082fc
6
+ metadata.gz: 1a5965daecea7f9044a77e7232a2d838a1b1aca81a96ef27043f1238cc1f946e7b2abca48537668bcc4dd743861f9985592a000c1230fa284c3627659d373906
7
+ data.tar.gz: b191d19713a1ae9821bac379007284c84de10c2994e1165ef648f188c363b2167f89105917911f0d2ca6ca4d716f44150b156aa5ff50c76e969aca55897ab1b6
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  # Changelog
2
+ ## [0.3.2] - 2026-01-05
3
+ ### Refactoring & Polish
4
+ - **DRY Logic**: Centralized "Efficiency" calculation; removed duplicate math from HTML templates.
5
+ - **Responsive UI**: Terminal output now adapts to screen width (instead of hardcoded 84 chars).
6
+ - **Tests**: Added unit tests for HTML Reporter generation.
7
+ - **Docs**: Improved formatting of the Command Line Options table.
8
+
2
9
  ## [0.3.1] - 2026-01-04
3
10
  *Major Architectural Repair & TTY Overhaul*
4
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_benchmark_suite (0.3.1)
4
+ rails_benchmark_suite (0.3.2)
5
5
  actionview (~> 8.1)
6
6
  activerecord (~> 8.1)
7
7
  activestorage (~> 8.1)
data/README.md CHANGED
@@ -120,10 +120,10 @@ bundle exec rails_benchmark_suite --profile --html
120
120
 
121
121
  | Flag | Description |
122
122
  | :--- | :--- |
123
- | `--html` | Generates a visual dashboard (`tmp/rails_benchmark_report.html`). **Best used with `--profile`.** |
124
- | `--profile` | **Diagnostic Mode.** Runs the benchmark twice (1 Thread vs Max Threads) to calculate "Scaling Efficiency." Required to populate the "Scaling Curve" charts. |
125
- | `--db` | Uses your local `config/database.yml` (Postgres/MySQL) instead of the synthetic in-memory SQLite. |
126
- | `-t [N]` | Manually set the thread count (Default: Auto-detects CPU cores). |
123
+ | `--html` | Generates a visual dashboard (`tmp/rails_benchmark_report.html`).<br>**Best used with `--profile`.** |
124
+ | `--profile` | **Diagnostic Mode.** Runs benchmark twice (1T vs MaxT) to calc efficiency.<br>Required for "Scaling Curve". |
125
+ | `--db` | Connects to local `config/database.yml` (Postgres/MySQL).<br>Bypasses in-memory SQLite. |
126
+ | `-t [N]` | Manually set thread count.<br>(Default: Auto-detects CPU cores). |
127
127
 
128
128
  ### Configuration Flags
129
129
  - `--json`: Output results in JSON format
@@ -5,6 +5,7 @@ require "tty-table"
5
5
  require "tty-box"
6
6
  require "pastel"
7
7
  require "tty-cursor"
8
+ require "tty-screen"
8
9
 
9
10
  module RailsBenchmarkSuite
10
11
  module Reporter
@@ -42,8 +43,10 @@ module RailsBenchmarkSuite
42
43
  "DB: #{info[:db_mode] || 'SQLite (Memory)'} | YJIT: #{yjit_status}#{yjit_hint}"
43
44
  ].join("\n")
44
45
 
46
+ box_width = [TTY::Screen.width, 84].min
47
+
45
48
  print TTY::Box.frame(
46
- width: 80,
49
+ width: box_width,
47
50
  title: { top_left: " Rails Benchmark Suite v#{RailsBenchmarkSuite::VERSION} " },
48
51
  padding: 1,
49
52
  style: {
@@ -179,8 +182,10 @@ module RailsBenchmarkSuite
179
182
  score_str = "#{score.round(0)}"
180
183
  puts ""
181
184
 
185
+ box_width = [TTY::Screen.width, 84].min
186
+
182
187
  print TTY::Box.frame(
183
- width: 40,
188
+ width: box_width,
184
189
  height: 5,
185
190
  align: :center,
186
191
  padding: 1,
@@ -102,7 +102,7 @@
102
102
  ips_mt = entry_mt ? entry_mt.ips : 0
103
103
 
104
104
  scaling = ips_1t > 0 ? (ips_mt / ips_1t) : 0
105
- efficiency = (ips_1t.to_f > 0) ? (ips_mt.to_f / (ips_1t * @payload[:threads])) * 100 : 0.0
105
+ efficiency = res[:efficiency] || 0.0
106
106
 
107
107
  eff_color = efficiency > 75 ? 'efficiency-high' : (efficiency > 50 ? 'efficiency-med' : 'efficiency-low')
108
108
  scale_color = scaling >= 1.0 ? 'text-success' : 'text-danger'
@@ -1,3 +1,3 @@
1
1
  module RailsBenchmarkSuite
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -61,6 +61,16 @@ module RailsBenchmarkSuite
61
61
  results.each do |r|
62
62
  base_weight = BASE_WEIGHTS[r[:name]] || 1.0
63
63
  r[:adjusted_weight] = base_weight / weight_pool
64
+
65
+ # Calculate Efficiency (DRY)
66
+ entries = r[:report].entries
67
+ entry_mt = entries.find { |e| e.label.include?("(#{@threads} threads)") }
68
+ entry_1t = entries.find { |e| e.label.include?("(1 thread)") }
69
+
70
+ ips_mt = entry_mt ? entry_mt.ips : 0
71
+ ips_1t = entry_1t ? entry_1t.ips : 0
72
+
73
+ r[:efficiency] = (ips_1t > 0) ? (ips_mt / (ips_1t * @threads)) * 100 : 0.0
64
74
  end
65
75
 
66
76
  # Calculate total score
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_benchmark_suite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - RailsBenchmarkSuite Contributors
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-01-04 00:00:00.000000000 Z
10
+ date: 2026-01-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: benchmark-ips