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

child_process.spawn is considerably slower in Node 12+ #41529

Closed
ion-dev opened this issue Jan 14, 2022 · 5 comments
Closed

child_process.spawn is considerably slower in Node 12+ #41529

ion-dev opened this issue Jan 14, 2022 · 5 comments
Labels
child_process Issues and PRs related to the child_process subsystem. performance Issues and PRs related to the performance of Node.js.

Comments

@ion-dev
Copy link

ion-dev commented Jan 14, 2022

Version

Node v12+

Platform

MacOS (Big Sur)

Summary

We've discovered an issue with Electron 12 and above (Node 14 and above), where spawning a child_process takes considerably longer than Electron 11 and lower (Node 12 and lower).

The issue appears to be related to the Node version - Here's an example app, with instructions, to demonstrate:
https://github.com/dev-manager-uk/spawn-delay

After running the app initially, you'll notice the spawn function takes ~10ms.

After upgrading Electron to 12 or higher, you'll notice the spawn function takes ~500ms!

What's changed to cause this and can anything be done about it?

Thanks!

-- UPDATE --

This bug only occurs on macOS running Big Sur AND only with Electron 12+. I tested on Windows 10 and macOS running Mojave and could not replicate. Electron 11 and lower are also fine.

To summarise, this delay only occurs on macOS running Big Sur with Electron 12 and greater.

@Mesteery Mesteery added child_process Issues and PRs related to the child_process subsystem. performance Issues and PRs related to the performance of Node.js. labels Jan 14, 2022
@RaisinTen
Copy link
Contributor

@dreamthen
Copy link

My mac platform version is monterey, and there is still a problem of 800ms slow.

@dreamthen
Copy link

The result is in the electron of running the same code on version 11 and version 12+ is that version 12+ is 800 ms slower.

@RaisinTen
Copy link
Contributor

Electron has already backported the libuv fix in electron/electron#33337 and updating libuv to v1.44.1 should fix the problem in Node.js and there is already a PR doing that here - #42340.

@santigimeno
Copy link
Member

#42340 already landed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. performance Issues and PRs related to the performance of Node.js.
Projects
None yet
Development

No branches or pull requests

5 participants