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

Use a PORO for field extension state instead of a Hash #4401

Merged
merged 7 commits into from
Jun 6, 2023

Conversation

rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Mar 23, 2023

When you have a field extension that doesn't produce a memo or modify object or arguments and doesn't add any extras, this will remove the allocated Hash from that case. That's not possible, but I think using a PORO will still improve performance.

@rmosolgo
Copy link
Owner Author

Ahh -- I forgot about the case where def resolve returns without yielding. In that case, GraphQL-Ruby has no chance to "pick up" the extended arguments at the end of the extension chain. That's why it has this Hash in the first place, it's a place to store this state while the chain is running, even if it ends early. We have to have some kind of out-of-bounds state object here. Maybe it could be a PORO instead, but the win there is minimal at best.

@rmosolgo rmosolgo changed the title Remove 'extended' hash from Field when it's unused Use a PORO for field extension state instead of a Hash Jun 6, 2023
@rmosolgo rmosolgo added this to the 2.0.23 milestone Jun 6, 2023
@rmosolgo rmosolgo merged commit 50d0e7f into master Jun 6, 2023
13 checks passed
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