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 Ruby YJIT for performance boost 🚀 #2127

Closed

Conversation

larouxn
Copy link
Contributor

@larouxn larouxn commented Jan 16, 2024

Follow up to the upgrade to Ruby 3.3.0, which brought with a much improved YJIT, this PR actually enables said YJIT for a supposed free performance boost of around 15%-25% latency wise.

Caveat being devdocs isn't a Rails codebase nor is it a massive app but regardless, this should be a free performance win with little to no possible downsides assuming devdocs is not running with minimal RAM. For further reference, here is a blog post on the performance increase, as well as PR that made YJIT easily enable-able for Rails on Ruby 3.3+.

As for the approach, I don't know a whole lot about Dockerfiles nor setting arbitrary env vars but I followed the following two guides/posts on how to enable YJIT, as they seem legitimate, having uses fly.io before myself.

@larouxn larouxn marked this pull request as ready for review January 16, 2024 14:18
@larouxn larouxn requested a review from a team as a code owner January 16, 2024 14:18
@simon04
Copy link
Contributor

simon04 commented Jan 21, 2024

Hi, the Docker files are provided only for people who want to self-host. The main instance devdocs.io is running on Heroku and is being deployed via .github/workflows/build.yml – do you think it's worth investigating/enabling YJIT on Heroku?

(@ojeytonwilliams, fyi)

@larouxn
Copy link
Contributor Author

larouxn commented Jan 21, 2024

Ah, understood. It looks like all we need to do to enable YJIT on Heroku is set the variable, according to the docs.

heroku config:set RUBYOPT="--enable-yjit"

I suppose we can close this PR unless we want to recommend enabling YJIT by default, which seems reasonable.

@larouxn
Copy link
Contributor Author

larouxn commented Feb 7, 2024

Closing this as the change can be made at the application level re: #2127 (comment).

@larouxn larouxn closed this Feb 7, 2024
@larouxn larouxn deleted the enable_ruby_yjit_for_perf_boost branch February 7, 2024 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants