Closed nickjj closed 6 months ago
Ruby 3.3.0 changed YJIT to be enabled by default but it's paused by default. This lets you toggle YJIT at runtime. There's also been quite a bit of memory optimizations in 3.3.0 vs 3.2.X. I'm happy to turn it on by default in this project.
The environment variable approach would still work. I went with this approach instead because Rails recently merged a PR which uses an initializer to enable YJIT at https://github.com/rails/rails/pull/49947. Now this project is compatible with that.
Debian Slim now has YJIT available thanks to https://github.com/docker-library/ruby/commit/6db728e.
That means it's available to use, which you can confirm with:
But it's not enabled by default. One of the easiest ways to enable it is by setting this environment variable
RUBYOPT=--yjit
. Technically this project is already equipped to use it. You can set that in your.env
and you're done.You can confirm it's "really" enabled and working by running:
I'm opening this issue mainly as a form of documentation and perhaps in the near'ish future we can enable it by default.
One of the main reasons why I didn't enable it by default already is because memory usage is higher with it enabled and that could play a role in production on a single server or more generally smaller server deploys. Rails is already pretty memory hungry especially when you account for running Puma, Sidekiq and Action Cable. Each of those processes will use more memory. Anything that amplifies that per process could have an impact.
What could be helpful here is to benchmark a couple of use cases to see how much extra memory it uses.