-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Enable YJIT by default if running Ruby 3.3+ #49947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was many public reports of 15-25% latency improvements for Rails apps that did enable Ruby 3.2 YJIT, and in 3.3 it's even better. Following ruby/ruby#8705, in Ruby 3.3 YJIT is paused instead of disabled by default, allowing us to enable it from an initializer.
@@ -0,0 +1,11 @@ | |||
# Automatically enable YJIT as of Ruby 3.3, as it bring very |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byroot I could be missing something, but this file and the next look identical to me. Do you only need one of them?
(If you only need one, the other one has a better comment so I vote that one.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 I messed up. Wanted to mv
, but ended up cp
...
@casperisfine just one question regarding the ordering of initializers. I am not very familiar with rails. Ideally YJIT should be enabled last, after all the other initializers have run. Is this the case here? |
It's not "last last" but close enough. The overwhelming majority of the boot sequence is done at this point. |
We can try to push it a bit further, but it's tricky. I want to introduce some other callback for other reasons, if that happens I may use them to enable YJIT even later. |
Will be the default in rails 7.2, see rails/rails#49947
Will be the default in rails 7.2, see rails/rails#49947
## Context Following the recent update of Ruby to version 3.3.0, we can now enable Ruby YJIT ## Description This PR simply adds an initializer to enable YJIT. For more details, see: - https://github.com/Shopify/yjit?tab=readme-ov-file - https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md - rails/rails#49947
There was many public reports of 15-25% latency improvements for Rails apps that did enable Ruby 3.2 YJIT, and in 3.3 it's even better.
Following ruby/ruby#8705, in Ruby 3.3 YJIT is paused instead of disabled by default, allowing us to enable it from an initializer.
FYI: @maximecb, @k0kubun, @XrXr