Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This PR disables code GC in the default mode, and adds
--yjit-code-gc
to optionally turn it on.Background
Enabling Code GC can be helpful for the following two purposes:
We haven't observed any real impact of (2) in production or local benchmarks. (1) has a more measurable impact, but this isn't that significant either at least on SFR. Also, the combination of #8705 and rails/rails#49947 may semi-automatically achieve (1) on Rails going forward. So it may not necessarily be useful to enable code GC in Ruby 3.3+.
On the other hand, you may want to disable code GC in the following two scenarios:
--yjit-exec-mem-size
is too small for the application, which runs code GC too frequently.We've already learned from #8522 that skipping compilation of long-tail cold code doesn't significantly impact production performance. Similarly, when experimenting with disabling code GC in production, it performed just as well as enabling it.
So, given that it not only is the behavior we use (for reforking with Pitchfork) but also removes the burden of monitoring
code_gc_count
from casual YJIT users, we thought it's better to disable code GC by default.