FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

optimize resolve routine by oliver-sanders · Pull Request #97 · graphql-python/graphql-ws · GitHub

optimize resolve routine - #97

Open
oliver-sanders wants to merge 1 commit into
graphql-python:masterfrom
oliver-sanders:optimize-resolve
Open

optimize resolve routine#97
oliver-sanders wants to merge 1 commit into
graphql-python:masterfrom
oliver-sanders:optimize-resolve

Conversation

Copy link
Copy Markdown
  • 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL