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

Get-FrequentFolders in ssh session is very slow #134

Open
atruskie opened this issue Aug 2, 2023 · 4 comments · May be fixed by #136
Open

Get-FrequentFolders in ssh session is very slow #134

atruskie opened this issue Aug 2, 2023 · 4 comments · May be fixed by #136

Comments

@atruskie
Copy link

atruskie commented Aug 2, 2023

I've noticed that whenever I SSH into a Windows 11 host with Z-Location as part of the profile that it takes 2-3 minutes to load my profile.

I've narrowed it down to Z-Location. Then, still in SSH, I started a new instance of pwsh -noprofile and manually ran the steps of the ZLocation.psm1 file to narrow down the slow part. The slow parts are:

  • Get-FrequentFolders | ForEach-Object {Add-ZWeight -Path $_ -Weight 0} which takes 260 seconds
    image
  • Get-FrequentFolders by itself takes 320 seconds
  • $QuickAccess = New-Object -ComObject shell.application takes 0.0022 seconds
  • $QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}") takes 0.012 seconds
  • $QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items() takes 320 seconds
  • The same call in the same shell in a terminal in the remote desktop of the host executes in 0.1 seconds

(I'm aware I'm using a slightly older version of z-location but the content of the functions in question are not substantially different)

I've disabled the Get-FrequentFolders part of the powershell module on my remote host and now profile loading is almost instant again.

I don't think the root cause of this issue is to do with Z-Location but rather some sort of COM weirdness within Win32-OpenSSH.

However, it would be nice to optionally disable that the Get-FrequentFolders function. Is that possible?

Other details:

  • PowerShell Version: 7.3.6
  • Windows Version: Windows 11 23H2 22631.2048
@MatejKafka
Copy link

I have a similar issue locally, without SSH – running Get-FrequentFolders takes 350 ms on my laptop, which is very slow, especially when you're supposed to load ZLocation on each PowerShell startup. Is the Quick Access lookup really so valuable from a UX perspective that it makes sense to spend 350 ms on each startup reading it? I'd also support removing it.

@VulumeCode
Copy link

For me this happened because an inaccessible network drive was pinned to Quick Access. Or rather, the link became inaccessible after upgrading to Windows 11. Unpinning and pinning it again worked, but it's still slower than without the pin and I don't need it.

Thanks, I wouldn't have found it without your investigation :) For you it's probably also smth about a network link.

@nohwnd
Copy link
Contributor

nohwnd commented May 22, 2024

Same issue here, profiling (with https://github.com/nohwnd/profiler) shows this as taking 500ms, and looking at the data it grabs it adds no value for me because I don't go to those same folders in commandline (e.g. my profile).

@nohwnd nohwnd linked a pull request May 22, 2024 that will close this issue
@nohwnd
Copy link
Contributor

nohwnd commented Jan 13, 2025

This repo seems dead, and I still depend on this tool. I tried to reach vors in the past, as well as here on the PRs. And so now I forked the repo, and am pushing new versions of the module to psgallery https://www.powershellgallery.com/packages/ZLocation2/2.1.1 Currently I fully removed the frequent folders functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants