-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Slow Start Times #176
Comments
I'm on a superfast Mac with SSD and it takes ~1s to startup, which is pretty slow. |
https://www.npmjs.org/package/time-require would be useful for debugging and profiling this. |
I used time-require & it shows: Start time: (2016-05-12 08:11:21 UTC) [treshold=1%] module time %1 chalk (../../gener...s/chalk/index.js) 22ms ▇ 1%
|
@dickeylth I would recommend upgrading to Node.js 6. They improved the require performance considerably in that version ;) |
@sindresorhus unfortunately my local node tools are still not ready for npm 3, and npm3 itself still has so many |
Still pretty darn slow these days... npm 6, node v8 |
This issue is still very much relevant. I'm on Node v10.5.0, npm v6.1.0 and yo v2.0.3 and its taking up towards 10 minutes between calling |
@Olian04 this is really abnormal. When we were talking about this, it was about lowering the startup time from ~1-2 seconds to near instant. Not minutes 😱 I'd be happy to help you figure out what's wrong. Try running |
@SBoudrias welp, thats some difference.... :/
|
The |
@SBoudrias I tried running |
@SBoudrias - I'm in the same boat as @Olian04 too. Might be a Windows 10 thing? I've got minutes before yo comes back with a list of generators. Same time if I specify a specific generator. @Olian04 from PowerShell it's an Environment variable. Try using this:
Here is my response. Most of the load time is before the yeoman guy shows up and then a good chunk before the logging starts too. After the log messages start showing up it's pretty quick.
|
Massive improvement upgrading to 2.0.3 but still I think slower than would be expected. Almost 2 minutes. here is my time-require:
|
@Olian04 @Tiberriver256 maybe some inspiration on gulpjs/gulp#1578 - looks like some windows users were having SSD disk issues which impacted node Theoretically, as yo is a top level dependency, I guess we could do some amount of bundling. But to me it's really unclear how much improvement this would end up giving people in your situation:
I'm open to suggestion. |
@Tiberriver256 thanks for the advice I'll have a go with it once I get back to work on Monday. @SBoudrias It might be worth mentioning that I've tried [email protected] & [email protected] both are as slow. However [email protected] is working as intended, so that's what I've been using previously. |
@SBoudrias I tried what @Tiberriver256 suggested, and this time it worked. PS C:\Users\xxqqvc\Projects\test> $Env:DEBUG = "yeoman:*"
PS C:\Users\xxqqvc\Projects\test> npx yo
npx: installed 1 in 2.19s
Path must be a string. Received undefined
C:\Users\xxqqvc\Projects\test\node_modules\yo\lib\cli.js
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-markstache/generators/app/index.js, trying to register +0ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-markstache/generators/app/index.js: markstache:app +0ms
yeoman:environment Registered markstache:app (C:\Users\xxqqvc\Projects\generator-markstache\generators\app\index.js) +1ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/app/index.js, trying to register +30ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/app/index.js: microservice:app +24ms
yeoman:environment Registered microservice:app (C:\Users\xxqqvc\Projects\generator-microservice\generators\app\index.js) +1ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-create/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-create/index.js: microservice:common-create +2ms
yeoman:environment Registered microservice:common-create (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-create\index.js) +0ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-update/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-update/index.js: microservice:common-update +1ms
yeoman:environment Registered microservice:common-update (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-update\index.js) +1ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-update-aurora/index.js, trying to register +3ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-update-aurora/index.js: microservice:common-update-aurora +2ms
yeoman:environment Registered microservice:common-update-aurora (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-update-aurora\index.js) +1ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-update-public/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/common-update-public/index.js: microservice:common-update-public +1ms
yeoman:environment Registered microservice:common-update-public (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-update-public\index.js) +2ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/core-create/index.js, trying to register +3ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/core-create/index.js: microservice:core-create +2ms
yeoman:environment Registered microservice:core-create (C:\Users\xxqqvc\Projects\generator-microservice\generators\core-create\index.js) +1ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/core-update/index.js, trying to register +3ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/core-update/index.js: microservice:core-update +1ms
yeoman:environment Registered microservice:core-update (C:\Users\xxqqvc\Projects\generator-microservice\generators\core-update\index.js) +1ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/java-create/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/java-create/index.js: microservice:java-create +2ms
yeoman:environment Registered microservice:java-create (C:\Users\xxqqvc\Projects\generator-microservice\generators\java-create\index.js) +0ms
yeoman:environment found C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/java-update/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/claxxqqvc/AppData/Roaming/npm/node_modules/generator-microservice/generators/java-update/index.js: microservice:java-update +2ms
yeoman:environment Registered microservice:java-update (C:\Users\xxqqvc\Projects\generator-microservice\generators\java-update\index.js) +0ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-markstache/generators/app/index.js, trying to register +3ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-markstache/generators/app/index.js: markstache:app +3ms yeoman:environment Registered markstache:app (C:\Users\xxqqvc\Projects\generator-markstache\generators\app\index.js) +0ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/app/index.js, trying to register +10ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/app/index.js: microservice:app +9ms
yeoman:environment Registered microservice:app (C:\Users\xxqqvc\Projects\generator-microservice\generators\app\index.js) +0ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/common-create/index.js, trying to register +1ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/common-create/index.js: microservice:common-create +2ms
yeoman:environment Registered microservice:common-create (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-create\index.js) +0ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/common-update/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/common-update/index.js: microservice:common-update +2ms
yeoman:environment Registered microservice:common-update (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-update\index.js) +1ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/common-update-aurora/index.js, trying to register +3ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/common-update-aurora/index.js: microservice:common-update-aurora +1ms
yeoman:environment Registered microservice:common-update-aurora (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-update-aurora\index.js) +1ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/common-update-public/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/common-update-public/index.js: microservice:common-update-public +1ms
yeoman:environment Registered microservice:common-update-public (C:\Users\xxqqvc\Projects\generator-microservice\generators\common-update-public\index.js) +1ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/core-create/index.js, trying to register +1ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/core-create/index.js: microservice:core-create +1ms
yeoman:environment Registered microservice:core-create (C:\Users\xxqqvc\Projects\generator-microservice\generators\core-create\index.js) +0ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/core-update/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/core-update/index.js: microservice:core-update +1ms
yeoman:environment Registered microservice:core-update (C:\Users\xxqqvc\Projects\generator-microservice\generators\core-update\index.js) +1ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/java-create/index.js, trying to register +1ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/java-create/index.js: microservice:java-create +1ms
yeoman:environment Registered microservice:java-create (C:\Users\xxqqvc\Projects\generator-microservice\generators\java-create\index.js) +0ms
yeoman:environment found C:/Users/xxqqvc/Projects/generator-microservice/generators/java-update/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/generator-microservice/generators/java-update/index.js: microservice:java-update +2ms
yeoman:environment Registered microservice:java-update (C:\Users\xxqqvc\Projects\generator-microservice\generators\java-update\index.js) +0ms
yeoman:environment found C:/Users/xxqqvc/Projects/test/node_modules/generator-git-migrator/generators/app/index.js, trying to register +2ms
yeoman:environment Resolve namespaces for C:/Users/xxqqvc/Projects/test/node_modules/generator-git-migrator/generators/app/index.js: git-migrator:app +2ms
yeoman:environment Registered git-migrator:app (C:\Users\xxqqvc\Projects\test\node_modules\generator-git-migrator\generators\app\index.js) +1ms
? 'Allo
! What would you like to do? Get me out of here!
_-----_ ╭───────────────────────╮
| | │ Bye from us! │
|--(o)--| │ Chat soon. │
`---------´ │ Yeoman team │
( _´U`_ ) │ https://yeoman.io │
/___A___\ /╰───────────────────────╯
| ~ |
__'.___.'__
´ ` |° ´ Y `
PS C:\Users\xxqqvc\Projects\test> |
Regarding how I've tested the latest version of Are you doing anything in particular to cause these delays? |
@MarcoScabbiolo not to my knowledge. |
@Olian04 I've reproduced your environment (Win 10, Node LTS 8.11.3) and I have a 5-6 seconds delay. Using WSL (Ubuntu) the delay is 1-2 seconds. All CLIs in Windows are very slow, PowerShell is not an exception. It is also usual for CLIs in Windows to get stuck while running any command, and you need to Ctrl + C to wake them up. If you have any other information about your environment that could be causing the minutes delay please let me know and I'll try to reproduce the conditions. |
5-6 seconds would be awesome. Both of us however are experiencing minutes. |
@MarcoScabbiolo don't know if it makes any difference but I'm installing yo locally and running it via a globally installed npx |
Seems like most of the time for me is spent here: |
Ran |
By the way I'm running these on a pretty beafy PC, 18 GB of RAM and an i7-7700 with two SSDs , but I don't think this accounts for the huge difference in the delay. |
@MarcoScabbiolo Just in case it matters; I'm on an i7-6820HQ with 16GB RAM and an ok SSD. As suggested in #589 i tried using #590/[email protected] but its the same result. Slow start, but once the first log line is printed it runs smooth and quick. |
@SBoudrias Looking at what @Tiberriver256 said it doesnt look like If Im able to reproduce the issue ill try to debug it. |
I'll throw my hat in the ring here as well, coming from another issue I posted and redirected here by @SBoudrias . I'm now experiencing this on two separate Windows machines. Things I've tried:
I am behind a corporate proxy, but the speed of the proxy doesn't seem to be an issue in any other application. Can someone give some insight in how you're producing your |
If you're having this issue running |
A simple |
@wsrast did you try to update |
Yes, I've tried that several times while working with the original issue. |
@wsrast Last version of |
2.0.5 is out. My bad, I didn't know npm respect |
Here's my update using 2.0.5. I've tried in turn using proxy, http-proxy, and https-proxy settings in my global .npmrc file, and all are functional, but they all show the ~3-5 minute delay. Here's the debugging information from the global-tunnel output. The long pause occurs after the second "Creating proxying agent" statement, and before "Available Generators:". It's worth noting that all the lines before the pause show up in just a few seconds.
|
I've just reverted to version 1.8.5 and performance has improved to less than 1 second for the same |
Definitively the delays are not caused by the proxy wrapper introduced, yo doctor
DEBUG global-tunnel: Found proxy in environment variable http_proxy
DEBUG global-tunnel: Proxy configuration to be used is {
"protocol": "http:",
"host": "localhost",
"port": 8080,
"proxyAuth": null
}
DEBUG global-tunnel: Creating proxying agent
DEBUG global-tunnel: Creating proxying agent
Yeoman Doctor
Running sanity checks on your system
✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
DEBUG global-tunnel: Requesting to https://registry.npmjs.org:443
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version
✔ yo version
Everything looks all right! It looks like the discovery of generators is taking too long, probably because its looking in too many directories recursively. |
@MarcoScabbiolo This occurs with calls to individual generators as well, not just "yo" or "yo --generators". |
The cli looks up for available generators running |
Anyone running into the issue could run a profiling with chrome dev tool remote debugging? This would be extremely useful and likely to point to the core issues. It could just be a library we bumped that has a performance regression in an hot path of yo. |
Just a thought, I'm using yeoman on Win10 with WSL, and its slow too. Are you by any chance using |
Ran a trace with clinic:
Looks like most of the time is spent inside You can copy-paste this HTML in jsbin to explore the graph https://gist.github.com/SBoudrias/3004406099a97f05478305311e5dc3a3 |
I'm on Win 7 and I've been quite annoyed at the slowness in running generators too, so I did some console.log debugging to try to figure out whats happening. I managed to cut almost 50% off time used before a prompt in an internal generator appears, by doing some small modifications to resolver.js, PR is here yeoman/environment#105. However, the biggest problem is definately somewhere in fast-glob or readdir-enhanced, as stated by @SBoudrias above, to me it seems to be using an unreasonable long time searching for generators with the @*/generators-* selector. |
After some more debugging, it looks to me like the underlying issue is with https://github.com/BigstickCarpet/readdir-enhanced/blob/master/lib/directory-reader.js, it seems to recurse folders which does not match the specified @*/generator-* pattern, making it traverse entire node_modules structures, when it only should be recursing into folders matching the pattern... |
|
I've cut down time to prompt further, by removing lookups in non-namespace folders when searching for generators in namespace folders. A PR is here yeoman/environment#106. In my current project, I've gone from around 20s until prompt from a generator appears, to 4s with the two submitted PRs. |
I am on a MacBook Pro with a fast SSD, yet Yeoman consistently take 1-2 seconds just to show the welcome menu. I hope these performance patches get released soon and we can see if they make a difference.
|
Having same issue here where anything involving the anyone got any ideas? Windows 10 too |
are there any updates here? yo 2.0.5 global installed |
I'm in the same boat with Windows 10 and its taking 10sec. Globally installed, cleared out any other node modules I could live without (only 7 remain). Would it be helpful for me to post additional logs or metrics? |
I also experienced minutes of delay after running yo. I did some debugging and found it was caused by running Then, I found this issue: https://npm.community/t/npm-version-takes-3-minutes-to-complete-when-run-in-child-process-and-behind-corporate-proxy/1658 After applying one of the workarounds mentioned there it was fixed: This also works: |
I'm facing this issue on Windows 10 right now. Yeoman takes over 30 seconds to run my local generator, whereas my colleagues on a mac have it run in under a second. Any ideas what can be done to improve this? I have no need to look up external generators, I simply want to run my local one. I did some more digging and this appears to be specific to running Yeoman inside WSL2 Unix instances on Windows 10. The same generator run from Powershell is fast, but when run inside WSL2 on Ubuntu takes over 40 seconds to start. This is with both my generator and a public one like Visual Studio Code's extension generator. |
👍 Thanks a lot @cliffred for the workaround, ❓ Does anybody know whether
📝 Notes
|
The ever-haunting issue with yo is the slow discovery of installed generators. I recall us getting it in check in the past, but has anyone else noticed it creeping up again?
The text was updated successfully, but these errors were encountered: