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

optimize resolve routine #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oliver-sanders
Copy link

  • The resolve routine was an async recursive function.
  • Because this function gets called for every returned value.
  • As a result, the number of async tasks can become extremely large for large or deeply nested GraphQL responses.
  • Python functions have overheads, async tasks have additional overheads on top, this created a severe performance bottleneck.
  • Simple solution, make the function iterative rather than recursive.

For an example usage in my project, this brought runtime down by ~10 seconds.

* The `resolve` routine was an async recursive function.
* Because this function gets called for every value, the number of
  async tasks can become extremely large for large or deeply nested
  GraphQL responses.
* Python functions have overheads, async tasks have additional overheads,
  this created a severe performance bottleneck.
* Simple solution, make the function iterative rather than recursive.
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.

1 participant