On the flip side, YJIT is probably one of the most memory-efficient JIT compilers out there (for any language). I say this having spoken to other JIT implementers.
We've worked really hard to reduce the memory overhead and at Shopify it's now down to less than 10% in our flagship production deployment.
Regardless, if memory usage is a legitimate concern for you, you can very easily remove the Rails initializer that turns on YJIT. You can choose between memory usage and response time. The choice is yours.
I can't even begin to fathom at how much work and testing must have went into YJIT to make it work as well as it does. Thank you!
And I went into some more details the talk I gave at RubyKaigi 2023: https://www.youtube.com/watch?v=X0JRhh8w_4I&t=2404s
But the good news is in Ruby 3.3 they are working towards reducing memory consumption even more. Someone from Shopify recently tweeted this in response to a question I asked about memory consumption:
> Our goal is to make the memory concern of YJIT to not be a thing for Ruby 3.3 anyway, so this really shouldn't be much of a concern
That's really exciting news. I mean it's already a huge deal to have YJIT and is worth using but now it's looking like a zero downside win all around and there's going to be no reason not to enable it.