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

Propagate ThreadContext through to_a implementations #5958

Merged
merged 3 commits into from Nov 7, 2019

Conversation

headius
Copy link
Member

@headius headius commented Nov 5, 2019

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.

headius added 3 commits Nov 5, 2019
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.
Most of these cases were improperly saving the context at the
point of contructing the size function.
@headius headius added this to the JRuby 9.2.10.0 milestone Nov 7, 2019
@headius headius merged commit 74c6702 into jruby:master Nov 7, 2019
5 checks passed
@headius headius deleted the to_a_context branch Nov 7, 2019
@headius headius mentioned this pull request Jul 13, 2020
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.

None yet

1 participant