Skip to content

Conversation

Hellzed
Copy link

@Hellzed Hellzed commented Jan 5, 2018

I've been checking per function performance on a project using Graphene, and it turns out the single biggest issue for simple queries is raw query parsing and subsequent conversion to AST.

The rationale for this PR is I've never seen anyone not at least caching queries at this step in production (some logging also usually happens here): enabling custom query parsing allows people to implement additional logic here without having to rewrite graphql-server-core (which they usually do for now).

A custom parsing step looks like this:

def parse_query(query, schema):
    ...
    return ast, validation_errors

Some LRU cache or logging can now easily be added on top of this.

Please check the following commit to see how it would work in practice:
Hellzed/aiohttp-graphql@2abe5d1

@syrusakbary
Copy link
Member

This PR is no longer needed, since now you can pass a custom backend to do caching or what you need to.

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.

2 participants