rails_benchmark_suite 0.2.4 → 0.2.6

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: 93d771423786c8f5cefc45aaabb973a6bf407d9025093a563ae938cf51562e1d
4
- data.tar.gz: 3a1568af625855012c88f44ad6172bdf794accee645d6233a77bb956ff1c7e90
3
+ metadata.gz: c0ba63e3d45287127a9fe0b288163f0d7bc8e0620a03ef2c9659732a6785e60f
4
+ data.tar.gz: 98e7c9a9cb433203ccb4cdaa07435753c7c696ee8dadc2df81d5b2e3b651cf94
5
5
  SHA512:
6
- metadata.gz: bf1b4acd86c9804e67b2d043441cdf09031dfc02d6152f36b486832b842d262bccf6d47ed5bc13a24fc795427498dc030c335b8d598543f067dd1a94db318011
7
- data.tar.gz: 6d5c9d5310b5ab617cba3db8903da03fb14df73f6887dfed199ce2e073a1c3377a57e927b18f66c04d350b6c462affdb6e90d6cdcd0b5cd4764bf797a740e96f
6
+ metadata.gz: 8c801578bae53257e375fb058ad14015785851bd1def663b1a52c5d271cc243e0af74746e96ffcc007b17f5fdcc5df414d010686e02c35a1816746fff93f23b5
7
+ data.tar.gz: 1216ba6595a80999820713962e2e41b01e94ccd662379a3b6c07334c0f2301e1ddd9588bf36f6354f3a958049f2c6ddd95f2280bd18802917d4df974efacdbfe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_benchmark_suite (0.2.2)
4
+ rails_benchmark_suite (0.2.6)
5
5
  actionview (~> 8.1)
6
6
  activerecord (~> 8.1)
7
7
  activestorage (~> 8.1)
data/README.md CHANGED
@@ -51,10 +51,39 @@ Add to your Gemfile:
51
51
  gem "rails_benchmark_suite", group: :development
52
52
  ```
53
53
 
54
- Run via bundle:
54
+ ## Quick Start
55
+
56
+ For the best performance measurement with YJIT enabled:
57
+
58
+ ```bash
59
+ ruby --yjit -S bundle exec rails_benchmark_suite
60
+ ```
61
+
62
+ ## Usage
63
+
64
+ To get the most accurate 'Heft' score within a Rails project context, run:
65
+
66
+ ```bash
67
+ ruby --yjit -S bundle exec rails_benchmark_suite
68
+ ```
69
+
70
+ **Why these flags?**
71
+ - `--yjit`: Enables the Ruby JIT compiler (significant for Rails 8+ performance).
72
+ - `-S`: Corrects the path to look for the executable in your current bundle.
73
+ - `bundle exec`: Prevents version conflicts (e.g., Minitest) between the gem and your host application.
74
+
75
+ **Standalone Usage:**
76
+ If running outside a Rails project:
77
+
78
+ ```bash
79
+ bin/rails_benchmark_suite
80
+ ```
81
+
82
+ **JSON Output:**
83
+ For programmatic consumption:
55
84
 
56
85
  ```bash
57
- bundle exec rails_benchmark_suite
86
+ ruby --yjit -S bundle exec rails_benchmark_suite --json
58
87
  ```
59
88
 
60
89
  > **Note:** Use `--skip-rails` to ignore the host application and run in isolated mode.
@@ -14,23 +14,32 @@ module RailsBenchmarkSuite
14
14
  @suites << { name: name, block: block }
15
15
  end
16
16
 
17
+ SETUP_MUTEX = Mutex.new
18
+
17
19
  def run
18
- # Senior Fix: Isolate from host application's database with Shared Cache (v0.2.4)
20
+ # Hardened Isolation: In-memory Shared Cache URI (v0.2.6)
19
21
  ActiveRecord::Base.establish_connection(
20
22
  adapter: "sqlite3",
21
- database: "file::memory:?cache=shared",
22
- pool: 16,
23
- timeout: 5000
23
+ database: "file:heft_db?mode=memory&cache=shared",
24
+ pool: 20,
25
+ timeout: 10000
24
26
  )
25
27
 
26
- # SQLite Performance Tuning for multi-threaded benchmarks
27
- db = ActiveRecord::Base.connection.raw_connection
28
- db.execute("PRAGMA journal_mode = WAL") # Write-Ahead Logging
29
- db.execute("PRAGMA synchronous = NORMAL") # Faster writes
30
- db.execute("PRAGMA busy_timeout = 5000") # Wait for lock instead of crashing
28
+ # Explicit Busy Timeout (Critical for multi-threading)
29
+ raw_db = ActiveRecord::Base.connection.raw_connection
30
+ raw_db.busy_timeout = 10000
31
+
32
+ # Setup Schema once safely with Mutex
33
+ SETUP_MUTEX.synchronize do
34
+ # Verify if schema already loaded by checking for a table
35
+ unless ActiveRecord::Base.connection.table_exists?(:users)
36
+ RailsBenchmarkSuite::Schema.load
37
+ end
38
+ end
31
39
 
32
- # Load Schema
33
- RailsBenchmarkSuite::Schema.load
40
+ # High-Performance Concurrency Pragmas
41
+ raw_db.execute("PRAGMA journal_mode = WAL")
42
+ raw_db.execute("PRAGMA synchronous = OFF")
34
43
 
35
44
  puts "Running RailsBenchmarkSuite Benchmarks..." unless @json_output
36
45
  puts system_report unless @json_output
@@ -90,7 +99,8 @@ module RailsBenchmarkSuite
90
99
 
91
100
  def system_report
92
101
  info = RailsBenchmarkSuite::Reporter.system_info
93
- "System: Ruby #{info[:ruby_version]} (#{info[:platform]}), #{info[:processors]} Cores. YJIT: #{info[:yjit] ? 'Enabled' : 'Disabled'}. Libvips: #{info[:libvips]}"
102
+ yjit_status = !!(defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?)
103
+ "System: Ruby #{info[:ruby_version]} (#{info[:platform]}), #{info[:processors]} Cores. YJIT: #{yjit_status ? 'Enabled' : 'Disabled'}. Libvips: #{info[:libvips]}"
94
104
  end
95
105
 
96
106
  def print_summary(results)
@@ -1,3 +1,3 @@
1
1
  module RailsBenchmarkSuite
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_benchmark_suite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - RailsBenchmarkSuite Contributors
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
10
  date: 2026-01-02 00:00:00.000000000 Z
@@ -204,7 +203,6 @@ metadata:
204
203
  source_code_uri: https://github.com/overnet/rails_benchmark_suite
205
204
  bug_tracker_uri: https://github.com/overnet/rails_benchmark_suite/issues
206
205
  changelog_uri: https://github.com/overnet/rails_benchmark_suite/blob/main/CHANGELOG.md
207
- post_install_message:
208
206
  rdoc_options: []
209
207
  require_paths:
210
208
  - lib
@@ -219,8 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
217
  - !ruby/object:Gem::Version
220
218
  version: '0'
221
219
  requirements: []
222
- rubygems_version: 3.5.22
223
- signing_key:
220
+ rubygems_version: 3.6.2
224
221
  specification_version: 4
225
222
  summary: Rails-style functionality & performance benchmark tool
226
223
  test_files: []