GraphQL endpoint is slower than equivalent REST endpoint
Summary
When making a GraphQL query that returns the same data as an existing REST endpoint, the GraphQL endpoint is slower than the equivalent REST API call.
Example
For example, the all_releases.query.graphql query (which is executed when rendering this project's Releases page) returns a very similar payload to the List Releases REST endpoint.
Here is a comparison of how they perform on GitLab.com:
GraphQL endpoint
REST endpoint
Results
| GraphQL | REST | |
|---|---|---|
| Average request time | 1.96s | 1.66s |
| Median request time | 1.91s | 1.58s |
In this example, the GraphQL requests finish about 20% slower than the REST calls.
In all cases (both GraphQL and REST), all of the time is spent in the "waiting" category according to Firefox's dev tools:
Further details
It's possible this discrepancy is related to how the release data specifically is exposed through the GraphQL endpoint.
However, I don't think this is the case, since both GraphQL and REST essentially just forward calls to the ReleasePresenter class.


