Skip to content
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

Enable YJIT by default if running Ruby 3.3+ #49947

Merged
merged 1 commit into from Nov 7, 2023
Merged

Conversation

byroot
Copy link
Member

@byroot byroot commented Nov 7, 2023

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

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.
@rails-bot rails-bot bot added the railties label Nov 7, 2023
@byroot byroot merged commit 632bcb3 into rails:main Nov 7, 2023
4 checks passed
@@ -0,0 +1,11 @@
# Automatically enable YJIT as of Ruby 3.3, as it bring very
Copy link
Member

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.)

Copy link
Member Author

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...

@maximecb
Copy link

maximecb commented Nov 7, 2023

@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?

@casperisfine
Copy link
Contributor

It's not "last last" but close enough. The overwhelming majority of the boot sequence is done at this point.

@casperisfine
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants