-
Notifications
You must be signed in to change notification settings - Fork 18
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
graphql-ws: optimise the "resolve" routine #548
graphql-ws: optimise the "resolve" routine #548
Conversation
* Partially addresses cylc#547 * The resolve routine is implmented recursively in the graphql-ws library. * Because the function is async this results in a large number of async tasks being created when the library is used with large, deeply nested schema. * Async tasks have an overhead, above that of regular function calls. * For the example in cylc#547 this resulted in over 10 seconds of overheads.
39e9f83
to
6c6a2b4
Compare
IMO Adding it and modifying it : Would be nice if these were separate commits to keep that info in the repo history? |
65b274f
to
a5d49e2
Compare
* Due to inheritance, we were calling `resolve(execution_result.data)` twice.
a5d49e2
to
1311fbb
Compare
That's somewhat satisfying @oliver-sanders ! |
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.
- Read code. I have views on readability, but I'm happy that the change replicates the functioning of the original. Might be nice to unit test it?
- Tried it out. Looks like there is a considerable speed gain for larger workflows.
Not pressed the approve button because it's still draft, presumably indicating futher work to come?
Might we unit test this function?
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.
- Took the liberty of removing the trailing whitespace causeing the style check to fail.
- Reviewed the changed code.
- Dave has given it a 👍🏼
Do you want to appoint a second review?
The actual diff is trivial and we're choked up ATM so might just slide this through on 1. |
Results 96% saving!:
base_async.resolve
):resolve.resolve
):Suggest adding this routine to the cylc-uiserver library for now as the graphql-ws library is not currently maintained (see #333).
The original implementation can be found here: https://github.com/graphql-python/graphql-ws/blob/7ef25ecfaf5390bf1a0cb4023272d8cb074368c2/graphql_ws/base_async.py#L37-L62
TODO:
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.