Skip to content
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

Performance is 20x worse than basic fetch -- Should I try V3? #5993

Closed
markhalonen opened this issue Feb 26, 2020 · 1 comment
Closed

Performance is 20x worse than basic fetch -- Should I try V3? #5993

markhalonen opened this issue Feb 26, 2020 · 1 comment

Comments

@markhalonen
Copy link

I think I have a similar problem to #4658

Using Apollo takes 300-400ms to perform the mutation. Copy-pasting the fetch request from the Chrome network tab and running only that takes 15ms.

I actually never want to use a cache and have done my best to disable it. I do like the functionality and type system of the hooks, which is why I'm using Apollo.

The mutation is very simple, just a few fields. The overall GraphQL schema is rather large, auto-generated by the awesome Postgraphile.

I see that V3 is "rewritten with performance in mind" #5948, should I try V3 beta? I have a fair amount of code in V2.

Or are there alternative libraries I should use if I don't care about the cache but want typing on the queries and loading, refetch etc?

@markhalonen
Copy link
Author

Ok, I figured it out!

It was causing several re-renders of my React component, and I confused the time it took to perform the re-render as part of Apollo's query..

I updated my query with ignoreResults like so

 const [startUserControl] = useMutation<StartUserControl, StartUserControlVariables>(START_USER_CONTROL, {
    ignoreResults: true
  })

and the query time is right in par with using fetch 🎉 🎉

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant