-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Perf improvement to stat in jest-resolve #11738
Comments
@sokra I wonder if this optimization can also be added to enhanced-resolve? |
Feel free to send a PR with this change, seems reasonable to me 🙂 Ideally there'd be a way to |
This only affects statSync. In very recent node.js versions there is an option to return undefined instead of throwing an error on not found |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
jest-resolve
specified its ownisFile
andisDirectory
.stat[Sync]
does some weird stuff by capturing a very large stack trace on failure (see here). Based on what we need from the errors ofstatSync
for resolving, we dont need these stack traces (as errors when resolving are much more "expected"). My proposal below should improve resolving performance (with included rough console.time numbers):To Reproduce
Create a "simulated" resolve environment (just forcing a lot of failed stat calls)
Expected behavior
If we prevent capturing these extended traces, we see much improved CPU time for these stat calls.
Is there any interest in this change? If so, I can make a simple PR to get this going. Apologies if this doesnt dall in "bug" work item type, but didnt think it was a feature either.
The text was updated successfully, but these errors were encountered: