-
Notifications
You must be signed in to change notification settings - Fork 580
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
require('google-cloud') takes 12 seconds to execute #1605
Comments
Ouch. We will look into that. |
This actually looks to be related to another issue (#1590) we're looking into. Have you thought about upgrading to npm3? Testing locally cut it down from 12 seconds to about 1 for me. |
@callmehiphop we are using gcloud package (the old one) on a Production environment and were planning to upgrade to google-cloud lib, but we are using Node Argon, and don't think we can migrate until Node 6 is flagged as LTS. Do you think is there any work-around for node 4 and npm 2 to avoid this huge load time ? |
Possibly running 'npm dedupe' after installing dependencies, and before starting your program. You can also upgrade npm to 3 'npm install -g npm' without affecting the Node version. |
@s3ththompson The issue can be reproduce by just installing google-cloud package on an empty directory, so there is nothing to dedupe. (Just in case I tested it, but is still taking a lot). |
dedupe should flatten all of our dependencies between our modularized google-cloud-* packages into one common place, which should make the 'require' times quicker, since they're not scattered all over the disk. So after installing, you ran 'npm dedupe', then ran your program, and still experienced 12 second startup times? |
Let me share the steps with you, just in case I'm doing something wrong:
I have reproduced this on Mac and Ubuntu (14.04), weird why nobody reported this |
Do you end up with a node_modules directory inside of tmp? Maybe try 'npm init -y && npm install --save google-cloud'. Not sure if dedupe will work without a package.json. Is there any sign the dedupe command is working? |
@stephenplusplus You are right, npm dedupe was not doing anything without a package.json. The bad thing if after adding the package and run dedupe ( and seeing a lot of dedupe output which was not there before) the bug still persists ( at least on Mac ). Will try the same thing on Ubuntu trusty later and will let you know. Thanks |
I believe this is a symptom of having our sub-modules (i.e. The I'll update here once the new release is out. |
After the release tonight of v0.41.0, the times went down dramatically for me:
Can you let me know if you're seeing the same improvement if you repeat the steps from the opening post? |
We're definitely much better now with v0.41.2, a release we just put out which uses shrinkwrap to force deduplication: $ time node -e "require('google-cloud')"
0.93s user 0.11s system 101% cpu 1.025 total |
@s3ththompson worked like a charm. Thanks a lot:
|
The
require
for the google-cloud package takes a lot to execute, about 12 seconds.Environment details
Steps to reproduce
The text was updated successfully, but these errors were encountered: