How fast is graphQL?
The speed of GraphQL is dependent on several factors: a graphQL call returns data to the frontend. The more data is returned, the longer the call is. This particular issue is the same for API calls. The speed will be impacted with how the implementation to gather the data is designed. This aspect is identical with API. In my experience, GraphQL has less boilerplates than API and that means it is easier to deploy some new GraphQL services. Conversely, API defines contracts using interfaces. These are a strong part of the implementation to help communicate the system architecture to varied stakeholders.
GraphQL can outperform API in 2 situations:
- For a same call with the same purpose, GraphQL can return less data without new code
- The implementation only performs data retrieval for the data that are needed in the response, also known as overfetching and underfetching.
The last point is likely where graphql excels whilst API is left behind.