Propagate ThreadContext through to_a implementations #5958
Merged
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.
This avoids bouncing through the metaClass to get the runtime,
which happens in these methods and in several downstream calls.
Several cases also needed the context, so this saves the extra
overhead of traversing the runtime, thread service, and thread
local to get the context.
This is a PR to get input. Some signatures change without a class-local replacement, so code compiled to those signatures on those classes would fail. I didn't want to leave deprecated no-arg versions all over the place.
There are also many other core IRubyObject methods that don't accept context.
I have not done any perf measurements but it's probably negligible. The main benefit is that the context will almost always be in cache for a given thread, since we pass it through almost all call paths.