Skip to content

Generate clients to go with cppgraphqlgen services #165

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

Merged
merged 66 commits into from
May 28, 2021

Conversation

wravery
Copy link
Contributor

@wravery wravery commented May 27, 2021

This PR fixes #161. It adds the clientgen utility and a common GraphQLClient.h header and graphqlclient runtime library which can be used to pre-parse/pre-validate a query and parse the response into a statically typed struct instead of handling arbitrary.

The initial motivation was to make consuming a cppgraphqlgen service easier, but the performance savings for this approach turned out to really nice. On my machine, the single-threaded throughput of the client_benchmark using a clientgen version of the same query is more than twice the throughput of benchmark which dynamically parses/validates the query and serializes the results to JSON instead of the strongly typed struct:

> benchmark 10000
Iterations: 10000
Throughput: 9184.42 requests/second
Overall (microseconds): 1088799 total, 108.88 average
Parse (microseconds): 49 median, 43 minimum, 286 maximum, 49.4173 average
Validate (microseconds): 5 median, 4 minimum, 63 maximum, 5.477 average
Resolve (microseconds): 46 median, 39 minimum, 317 maximum, 50.139 average
ToJSON (microseconds): 2 median, 1 minimum, 26 maximum, 2.0137 average

> client_benchmark 10000
Iterations: 10000
Throughput: 20755.2 requests/second
Overall (microseconds): 481806 total, 48.1806 average
Resolve (microseconds): 45 median, 35 minimum, 314 maximum, 46.1472 average
ParseServiceResponse (microseconds): 0 median, 0 minimum, 31 maximum, 0.2003 average
ParseResponse (microseconds): 1 median, 1 minimum, 30 maximum, 1.5946 average

wravery and others added 30 commits May 17, 2021 22:11
wravery and others added 28 commits May 24, 2021 22:20
@wravery wravery merged commit 9cbad08 into microsoft:main May 28, 2021
@wravery wravery deleted the clientgen branch June 15, 2021 02:42
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.

Feature: generate GraphQL clients
1 participant