-
Couldn't load subscription status.
- Fork 3
refactor(executor, router): define ClientRequestDetails only once and avoid all clones, improve how coerce_variables is done
#532
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
Conversation
Summary of ChangesHello @dotansimha, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant refactoring to how Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request is a great refactoring that defines ClientRequestDetails once per request and passes it by reference, successfully avoiding many clones in the request pipeline. This improves performance and code clarity.
My review focuses on fully achieving the goal of "avoiding all clones". I've identified a couple of remaining heap allocations for the operation's name and query and provided a suggestion to eliminate them by adjusting the OperationDetails struct to use references. This change would make the request processing even more efficient, in line with the repository's performance-first style guide.
✅
|
|
🐋 This PR was built and pushed to the following Docker images: Image Names: Platforms: Image Tags: Docker metadata{
"buildx.build.ref": "builder-416cd0cb-880f-4099-b9e4-a1a092b42a2b/builder-416cd0cb-880f-4099-b9e4-a1a092b42a2b0/axmz96fj2ea97kjx4qxdw7lo6",
"containerimage.descriptor": {
"mediaType": "application/vnd.oci.image.index.v1+json",
"digest": "sha256:b1f09b70b597cdccc96fbc1e3e1256cd2394fbbd89f1e181856b9b0020b497c9",
"size": 1609
},
"containerimage.digest": "sha256:b1f09b70b597cdccc96fbc1e3e1256cd2394fbbd89f1e181856b9b0020b497c9",
"image.name": "ghcr.io/graphql-hive/router:pr-532,ghcr.io/graphql-hive/router:sha-410114f"
} |
95b6aa4 to
bf644fa
Compare
ClientRequestDetails only once and avoid all clonesClientRequestDetails only once and avoid all clones, improve how coerce_variables is done
bf644fa to
fbd475f
Compare
We've seen that
ClientRequestDetailsis already used in multiple places, and the current implementation tries to avoid re-creating it by doing lazy init only when it's really used - which might still lead to multiple creation.The original reason behind it was an issue with the lifetime definition of
ClientRequestDetails.Since
ClientRequestDetailsis constructed with data from multiple places, it needs to declare multiple lifetimes, based on where the data actually came from. This is the new definition:In addition, this PR removed the need to clone the
queryand put it into aCowin order to pass it around during execution. To do that, I changed the wayExecutionRequestis passed around -coerce_variablesno longer takes ownership, and the way we have variables (and no variables) is also improved now.