Skip to Content
Octopus Energy Packages

Compare clients

Compare features, browser bundle size, and cold-start import cost with graphql-request

Compare the API capabilities, browser bundle sizes, and first-import times of createGraphQLRequest and GraphQLClient from graphql-request.

To switch clients, see From graphql-request.

We also measured request throughput with stubbed Fetch and a local HTTP server. We omitted those results because the absolute timing differences were small and the tests did not capture the network latency or server processing of a remote API.

Features

CapabilitycreateGraphQLRequestGraphQLClient
Infer result and variable types
Read partial data and errors
Error policy per call
Operation name inference
Custom Fetch transport
Request and response middleware
GraphQL over GET
Batch requestsUnavailable
Works without the graphql peer dependency

See Configure requests and the graphql-request documentation for examples.

Browser bundle size

With gzip, the full browser bundle measured 3.54 KB for createGraphQLRequest and 12.61 KB for GraphQLClient, including each client’s dependencies.

The second comparison shows how many bytes each client adds to a bundle that already exports graphql from gql.tada.

Bundle size format
Full bundle
  • createGraphQLRequest3.54 KB
  • GraphQLClient12.61 KB
Bundle growth with gql.tada
  • createGraphQLRequest1.39 KB
  • GraphQLClient12.07 KB

Cold-start import cost

The median first import took 0.60 ms for createGraphQLRequest and 4.25 ms for GraphQLClient. This time contributes to a serverless cold start when the function imports the client during initialization.

Median first import time
  • createGraphQLRequest0.60 ms
  • GraphQLClient4.25 ms

On this page