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(jest-resolve): Remove redundant realpath call #14053

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

eps1lon
Copy link
Contributor

@eps1lon eps1lon commented Apr 4, 2023

Summary

Removes a redundant call to realpathCached. resolve already calls realpath due to preserveSymlinks: false so the subsequent realpathCached call was redundant.

In test suites resolving a lot of files, realpathCache can become a real hotpath. Since resolving files is done during test-setup, it's important that resolving modules is as fast as possible. So even if we know we'll hit the cache, we should avoid calling at all if we know for certain it's just hitting the cache. Since these calls are right next to each other I don't see the danger of accidentally not resolving symlinks.

Test plan

  • CI (same test failures on master)
  • Patch works on internal test suite

@eps1lon eps1lon marked this pull request as ready for review April 4, 2023 19:34
@eps1lon eps1lon force-pushed the fix/resolve-perf-realpath branch from 0c96114 to 4cfad49 Compare April 5, 2023 08:44
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

Nice 👍 I think this is leftover from before we migrated (back) to resolve

@SimenB SimenB merged commit 279f97c into jestjs:main Apr 8, 2023
DmitryMakhnev pushed a commit to DmitryMakhnev/jest that referenced this pull request May 5, 2023
@github-actions
Copy link

github-actions bot commented May 9, 2023

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 May 9, 2023
@eps1lon eps1lon deleted the fix/resolve-perf-realpath branch May 9, 2023 13:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants