Skip to content

Commit 632bcb3

Browse files
authored
Merge pull request rails#49947 from Shopify/enable-yjit
Enable YJIT by default if running Ruby 3.3+
2 parents 488a7ce + c29cda2 commit 632bcb3

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

railties/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
* Enable YJIT by default on new application running Ruby 3.3+
2+
3+
Adds a `config/initializers/enable_yjit.rb` initializer that enable YJIT
4+
when running on Ruby 3.3+.
5+
6+
*Jean Boussier*
7+
18
* In Action Mailer previews, show date from message `Date` header if present.
29

310
*Sampat Badhe*
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Automatically enable YJIT as of Ruby 3.3, as it bring very
2+
# sizeable performance improvements.
3+
4+
# If you are deploying to a memory constrained environment
5+
# you may want to delete this file, but otherwise it's free
6+
# performance.
7+
if defined? RubyVM::YJIT.enable
8+
Rails.application.config.after_initialize do
9+
RubyVM::YJIT.enable
10+
end
11+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Automatically enable YJIT if running Ruby 3.3 or newer,
2+
# as it brings very sizeable performance improvements.
3+
# Many users reported 15-25% improved latency.
4+
5+
# If you are deploying to a memory-constrained environment,
6+
# you may want to delete this file, but otherwise, it's free
7+
# performance.
8+
if defined? RubyVM::YJIT.enable
9+
Rails.application.config.after_initialize do
10+
RubyVM::YJIT.enable
11+
end
12+
end

railties/test/generators/app_generator_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
config/initializers
5252
config/initializers/assets.rb
5353
config/initializers/content_security_policy.rb
54+
config/initializers/enable_yjit.rb
5455
config/initializers/filter_parameter_logging.rb
5556
config/initializers/inflections.rb
5657
config/locales

0 commit comments

Comments
 (0)