-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Optimize import fixes for projects with many symlinks #42150
Optimize import fixes for projects with many symlinks #42150
Conversation
@typescript-bot pack this |
Heya @andrewbranch, I've started to run the tarball bundle task on this PR at f51e232. You can monitor the build here. |
@typescript-bot pack this |
Heya @andrewbranch, I've started to run the tarball bundle task on this PR at 4afb9cc. You can monitor the build here. |
Hey @andrewbranch, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
4afb9cc
to
a192859
Compare
I don't know the code well enough to have detailed comments, but since this is a perf fix, any idea what the difference in memory usage is? Is the scale of the cache going to remain small enough not to matter? |
@sandersn I didn’t measure it, partly because since it’s just path strings, it’s obviously dependent upon the length of the paths but you can do the estimation in your head, and it would take quite a lot of path strings to add up to anything appreciable. And since non-pnpm users tend not to have more than a handful of symlinks in the first place, the typical memory impact will be near-zero. Only users who are currently getting absolutely miserable time performance should see anything approaching a few kB. |
This is a separate follow-up to #42095, incorporating and building on @walkerburgin’s investigations. The main difference between this PR and @walkerburgin’s experiment (besides the inclusion of #42095) is that this tries directories from the imported filename to key into the realpath->symlink map instead of iterating through all entries of the map.
Fixes #40584
Forgot to share perf numbers. Scenario: private repo shared here. Opened file shown in screenshot. Restart TS Server with that file open. Move cursor to
OnInit
to triggergetCodeFixes
. From fixes menu, choose “Add all missing imports” to triggergetCombinedCodeFix
.