-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Spawning a child process on Windows is really slow, takes minutes to complete #142
Comments
Can your try running it with Node.js child_process instead of execa? It might have nothing to do with execa itself. |
@SamVerschueren |
@SamVerschueren |
Test run with native
|
Run | MacOS | Windows |
---|---|---|
1 npm whoami |
1256.060359 ms = 1.256 sec |
189733.792206 ms = 189.7338 sec = 3.162 min |
2 git status |
16.693848 ms (x75.24091264039304 times faster) |
161.197277 ms (x1177.02851894948573 times faster) |
test script:
const { execFile } = require('child_process');
const precise = require('precise');
const timer = precise();
// Node does not support PATHEXT on Windows
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
timer.start();
execFile(npmCmd, ['whoami'], (error, stdout, stderr) => {
timer.stop();
console.log('Message received in', timer.diff() / 1000000, 'ms');
if (error) {
console.error(error);
} else {
console.log(stdout);
}
const timer2 = precise();
timer2.start();
execFile('git', ['status'], (error, stdout, stderr) => {
timer2.stop();
console.log('Message received in', timer2.diff() / 1000000, 'ms');
if (error) {
console.error(error);
} else {
console.log(stdout);
}
});
});
Windows 10:
C:\eplatform\git-repos\patterns-library>npm run test-child-spawn-nodejs
> @axa-ch/[email protected] test-child-spawn-nodejs C:\eplatform\git-repos\patterns-library
> node ./stack/tasks/test-child-spawn-nodejs.js
Message received in 189733.792206 ms
user-name
Message received in 161.197277 ms
On branch bugfix/windows-spawn-hangs
Your branch is up-to-date with 'origin/bugfix/windows-spawn-hangs'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/
patterns-library.iml
nothing added to commit but untracked files present (use "git add" to track)
Mac OSX El Capitan Version 10.11.6:
npm run test-child-spawn-nodejs
> @axa-ch/[email protected] test-child-spawn-nodejs /Users/axawinterthur/dev/axa-ch_style-html-guide
> node ./stack/tasks/test-child-spawn-nodejs.js
Message received in 1256.060359 ms
andyogo
Message received in 16.693848 ms
On branch bugfix/windows-spawn-hangs
Your branch is up-to-date with 'github/bugfix/windows-spawn-hangs'.
nothing to commit, working tree clean
@SamVerschueren |
I just created an issue at node's repo: |
Issue at npm: |
@SamVerschueren Using Original workaround found in: New issue at NPM's new issue tracker: |
@sindresorhus This issues of not handling proxy environments dates back to |
Got docs on proxy here: https://github.com/sindresorhus/got#proxies npm should probably use https://github.com/np-maintain/global-tunnel so all the tools they depend on also use the set proxy info. |
@sindresorhus Unfortunately those links do not provide reasonable solutions if a user just wants to use Maybe node should have proxy support by environment variables backed in, though current status is definitly not ideal... Actually I'm also convinced that's a bug in |
Yes, it does,
It should, but the core team doesn't seem interested in solving the problem: nodejs/node#8381 |
Thanks a lot, seems you faced this issue several times already... |
I experience a really weird massive delay on windows by running
npm
orgit
as a child process.Compared to my running it on MacOS, windows takes ages to complete 🤔
These are my test scripts:
Timing those calls:
The first call is significantly slower than the second call (that's maybe due to JIT).
But the difference between MacOS and Windows is tremendous:
npm whoami
1289.505351 ms
=1.2895 sec
189807.887698 ms
=189.8079 sec
=3.1635 min
git status
15.803947 ms
(x81.59387974409178
times faster)201.531065 ms
(x941.82942812315312
times faster)test script:
Windows 10:
Mac OSX El Capitan Version 10.11.6:
The text was updated successfully, but these errors were encountered: