8000 Enable YJIT by default if running Ruby 3.3+ by byroot · Pull Request #49947 · rails/rails · GitHub
[go: up one dir, main page]

Skip to content

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

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

segiddins added a commit to rubygems/rubygems.org that referenced this pull request Apr 23, 2024
segiddins added a commit to rubygems/rubygems.org that referenced this pull request Apr 23, 2024
vincent-pochet added a commit to getlago/lago-api that referenced this pull request May 14, 2024
## 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
crpahl

This comment was marked as off-topic.

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.

7 participants
0