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

fix: only check for watchman existence once per process #14826

Merged
merged 3 commits into from
Jan 2, 2024

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jan 2, 2024

Summary

While looking at #14818, I noticed that we spawned a check for watchman for every single project as well.

before:
image

After:

image

~440ms to ~8ms in this extreme example

The call to watchman itself is still about 14ms of course, but it happens outside of the build calls. This means that if you install watchman while Jest is running, that won't be picked up. But I think that's perfectly fine.


We should try to fix the createWatcher call as well

image

Test plan

CI

Copy link

netlify bot commented Jan 2, 2024

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7df45c8
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/6593fe15d8074500083f8096
😎 Deploy Preview https://deploy-preview-14826--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has nothing to do with the other fix, just sneaking it in as #14804 missed it

@SimenB SimenB merged commit 349afc3 into jestjs:main Jan 2, 2024
73 checks passed
@SimenB SimenB deleted the only-check-watchman-installation-once branch January 2, 2024 13:55
@@ -216,7 +218,6 @@ class HasteMap extends EventEmitter implements IHasteMap {
private _cachePath = '';
private _changeInterval?: ReturnType<typeof setInterval>;
private readonly _console: Console;
private _isWatchmanInstalledPromise: Promise<boolean> | null = null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this made the check happens once per project, while we now do it once per module scope (i.e. once per worker/thread/process)

@@ -50,6 +50,7 @@
### Performance

- `[*]` [**BREAKING**] Bundle all of Jest's modules into `index.js` ([#12348](https://github.com/jestjs/jest/pull/12348), [#14550](https://github.com/jestjs/jest/pull/14550) & [#14661](https://github.com/jestjs/jest/pull/14661))
- `[*]` [jest-haste-map] Only spawn one process to check for `watchman` installation ([#14826](https://github.com/jestjs/jest/pull/14826))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah, totally wrong format 😅

should be

 `[jest-haste-map]` Only spawn one process to check for `watchman` installation ([#14826](https://github.com/jestjs/jest/pull/14826))

Copy link

github-actions bot commented Feb 2, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

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

Successfully merging this pull request may close these issues.

1 participant