rails_benchmark_suite 0.2.5 → 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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +31 -2
- data/lib/rails_benchmark_suite/runner.rb +20 -12
- data/lib/rails_benchmark_suite/version.rb +1 -1
- metadata +2 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c0ba63e3d45287127a9fe0b288163f0d7bc8e0620a03ef2c9659732a6785e60f
|
|
4
|
+
data.tar.gz: 98e7c9a9cb433203ccb4cdaa07435753c7c696ee8dadc2df81d5b2e3b651cf94
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c801578bae53257e375fb058ad14015785851bd1def663b1a52c5d271cc243e0af74746e96ffcc007b17f5fdcc5df414d010686e02c35a1816746fff93f23b5
|
|
7
|
+
data.tar.gz: 1216ba6595a80999820713962e2e41b01e94ccd662379a3b6c07334c0f2301e1ddd9588bf36f6354f3a958049f2c6ddd95f2280bd18802917d4df974efacdbfe
|
data/Gemfile.lock
CHANGED
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
|
-
|
|
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,25 +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
|
-
#
|
|
20
|
+
# Hardened Isolation: In-memory Shared Cache URI (v0.2.6)
|
|
19
21
|
ActiveRecord::Base.establish_connection(
|
|
20
22
|
adapter: "sqlite3",
|
|
21
|
-
database: "file
|
|
22
|
-
pool:
|
|
23
|
-
timeout:
|
|
23
|
+
database: "file:heft_db?mode=memory&cache=shared",
|
|
24
|
+
pool: 20,
|
|
25
|
+
timeout: 10000
|
|
24
26
|
)
|
|
25
27
|
|
|
26
|
-
#
|
|
28
|
+
# Explicit Busy Timeout (Critical for multi-threading)
|
|
27
29
|
raw_db = ActiveRecord::Base.connection.raw_connection
|
|
28
|
-
raw_db.
|
|
29
|
-
raw_db.execute("PRAGMA synchronous = NORMAL") # Faster writes
|
|
30
|
+
raw_db.busy_timeout = 10000
|
|
30
31
|
|
|
31
|
-
#
|
|
32
|
-
|
|
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
|
|
33
39
|
|
|
34
|
-
#
|
|
35
|
-
|
|
40
|
+
# High-Performance Concurrency Pragmas
|
|
41
|
+
raw_db.execute("PRAGMA journal_mode = WAL")
|
|
42
|
+
raw_db.execute("PRAGMA synchronous = OFF")
|
|
36
43
|
|
|
37
44
|
puts "Running RailsBenchmarkSuite Benchmarks..." unless @json_output
|
|
38
45
|
puts system_report unless @json_output
|
|
@@ -92,7 +99,8 @@ module RailsBenchmarkSuite
|
|
|
92
99
|
|
|
93
100
|
def system_report
|
|
94
101
|
info = RailsBenchmarkSuite::Reporter.system_info
|
|
95
|
-
|
|
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]}"
|
|
96
104
|
end
|
|
97
105
|
|
|
98
106
|
def print_summary(results)
|
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
|
+
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.
|
|
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: []
|