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

Significantly slower under Meteor and unbundled server contexts #7523

Closed
jimrandomh opened this issue Dec 27, 2020 · 2 comments
Closed

Significantly slower under Meteor and unbundled server contexts #7523

jimrandomh opened this issue Dec 27, 2020 · 2 comments

Comments

@jimrandomh
Copy link

Apollo-Client is significantly slower when running out of a Meteor server environment or a node_modules folder than when it's running inside of a bundle which has had process.env.NODE_ENV preprocessed into a string. This PR fixes it, but seems to have fallen through the cracks. The problem is that in node, process.env is actually a slow API function, not suitable for being called in any sort of inner loop, but apollo-client is using it as though it was fast.

@benjamn
Copy link
Member

benjamn commented Jan 4, 2021

@jimrandomh You're right about process.env.NODE_ENV being slow in Node, but (unfortunately!) the syntax of the process.env.NODE_ENV === ... checks is important for minifiers to be able to strip out development-only code in production. I don't love that convention, but it's the same convention React uses, so various bundlers and starter codes will already have it configured, which saves Apollo Client from introducing its own additional requirements for proper minification. In Meteor, although the JS minifier does automatically replace process.env.NODE_ENV with a string literal, minification happens only for browser code, which is why process.env.NODE_ENV remains intact.

@hwillson
Copy link
Member

Let us know if this is still a concern with @apollo/client@latest - thanks!

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

No branches or pull requests

4 participants