Skip to content

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