Skip to content

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

Merged
SimenB merged 3 commits into
jestjs:mainfrom
SimenB:only-check-watchman-installation-once
Jan 2, 2024
Merged

SimenB merged 3 commits into
jestjs:mainfrom
SimenB:only-check-watchman-installation-once

Conversation

@SimenB

@SimenB SimenB commented Jan 2, 2024 •

Copy link
Copy Markdown
Member

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

@netlify

netlify Bot commented Jan 2, 2024 •

Copy link
Copy Markdown

✅ 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
Copy Markdown
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
@SimenB
SimenB deleted the only-check-watchman-installation-once branch January 2, 2024 13:55
private _cachePath = '';
private _changeInterval?: ReturnType<typeof setInterval>;
private readonly _console: Console;
private _isWatchmanInstalledPromise: Promise<boolean> | null = null;

Copy link
Copy Markdown
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)

Comment thread CHANGELOG.md
### 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
Copy Markdown
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))

@github-actions

github-actions Bot commented Feb 2, 2024

Copy link
Copy Markdown

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