Giter Club home page Giter Club logo

Comments (11)

DavidZidar avatar DavidZidar commented on June 12, 2024 2

In case anyone is interested in only the colors like I was here's my configuration inspired by this project but using the experimental PowerShell 7.2 feature PSANSIRenderingFileInfo. No performance issues, works great imo, no icons though.
https://gist.github.com/DavidZidar/1cfef361ff659aef68cef25ebd547fa9

from terminal-icons.

DavidZidar avatar DavidZidar commented on June 12, 2024 1

I just noticed I have this issue as well. I can literally see it list the files one at a time, about 10-20 or so a second.

I don't see any noticeable delay when listing directories but files get much slower on a network drive. If I re-run the ls command it's still slow but noticeably faster the second time around. I'm guessing metadata is cached.

Calling it while wrapped in Measure-Command makes it go as fast as without Terminal-Icons, so that's not helpful.

from terminal-icons.

JensGJ avatar JensGJ commented on June 12, 2024 1

I have the same issue. Here is a couple of findings:

The file size of the individual file is clearly playing a role in the processing time for terminal icons. In my sample directory a single file of 16 MB takes +30 seconds to list - whereas listing 63 files less than 1 MB each takes less than 28 seconds.
Just by looking at the output it is clear that the larger the file is the longer it takes to render with terminal icons activated.
Without terminal icons the entire directory is listed immediately.

The slow performance is present both in Powershell 7 and Windows Powershell 5 (7.2.6 and 5.1 to be specific).

The problem might be related to connections on VPN - I recall having had similar issues before, but haven't tested on the company network again.

The FAQ on Oh My Posh mentions that an exclusion on Windows Defender needs to be configured. This is not the case in my setup - but Oh My Posh runs fine if Terminal Icons is not enabled.

Any help will be appreciated.

from terminal-icons.

Tiberriver256 avatar Tiberriver256 commented on June 12, 2024 1

Potentially faster:

[system.io.file]::GetAttributes($_.FullName) -eq [System.IO.FileAttributes]::Directory

The downside is it only works on file systems. It'll throw an exception if you try and run it on something returned from dir HKCU: for example.

from terminal-icons.

rafma0 avatar rafma0 commented on June 12, 2024 1

I'm not sure if it's related with what you're all describing but I have a local folder with lots of LARGE .zip files and using this module sometimes triggers my antivirus to check those files when I ls (if I check the processes I can see kaspersky using a lot of disk resources) and the files are listed to me one by one. If I try with ls | fw or I unload the module and try ls again, then the files are listed instantly.

edit: I also made a module based on @DavidZidar idea, using the current colors from Terminal-Icons (except for default folder), considering the limitations of PSANSIRenderingFileInfo (like you can't set colors for specific files or folder names etc). Here https://gist.github.com/rafma0/ba70b41e3a100b88307703408dd7a795

from terminal-icons.

devblackops avatar devblackops commented on June 12, 2024

Thanks for the issue @marrsalles.

I'm not able to reproduce the extreme latency you're seeing. Here is what I did:

  1. Create Azure storage account with SMB file share in eastus (which has about 75ms latency for me).
  2. Mounted file share as z: drive
  3. Created 100 directories
  4. Ran measure-command {ls}

With SMB info cached:
Terminal-Icons: 160ms
No Terminal-Icons: 4ms

I'm not aware of anything in Terminal-Icons that would require a roundtrip to the SMB share. I do call PSIsContainer on each IO.FileSystemInfo object that Get-ChildItem returns. Perhaps accessing that property could generate a round trip operation if information isn't in the SMB cache. I'll play around a bit more.

from terminal-icons.

mattcargile avatar mattcargile commented on June 12, 2024

I've been playing with a bit. I've concluded some of the slowness is attributed to $_.PSIsContainer within a custom ps1xml file that had an if block within it in like, "if (-not $_.PSIsContainer)".

I did try ls | fw it was faster. I removed the if check above and it worked faster on pwsh.exe --version , 7.2.1. I assume failures within a [scriptblock] within the ps1xml file are converted to empty strings so I didn't need that if check. Maybe there is some caching involved too, like you all said, because mine sped up the more I played with it. It could have also been my VPN and network.

After typing this comment up, I'm not sure all the way if I did something that helped.

from terminal-icons.

JensGJ avatar JensGJ commented on June 12, 2024

Tested again without VPN. Still noticeably slower with terminal icons activated than without, but way faster than on my home connection with VPN (approximately 7 seconds for listing the same directory that took +1 minute from home).

from terminal-icons.

mattcargile avatar mattcargile commented on June 12, 2024

Yeah I just end up living with it and I sometimes just run ls | fw which can be faster. I also use PowerShellHumanizer and even more customized formatter which slows me down a bit more. Not sure much can be done to speed up the formatter. Most of the time it works well enough and the colors and icons are worth it.

from terminal-icons.

JensGJ avatar JensGJ commented on June 12, 2024

For testing purpose I've used the following:

$timer = [Diagnostics.Stopwatch]::StartNew(); ls ; $timer.stop(); $timer

(since measure-command as mentioned earlier cannot be used because the slow performance is only present when the ls output is displayed in the console).

from terminal-icons.

mattcargile avatar mattcargile commented on June 12, 2024

I'm not sure if it's related with what you're all describing but I have a local folder with lots of LARGE .zip files and using this module sometimes triggers my antivirus to check those files when I ls (if I check the processes I can see kaspersky using a lot of disk resources) and the files are listed to me one by one. If I try with ls | fw or I unload the module and try ls again, then the files are listed instantly.

edit: I also made a module based on @DavidZidar idea, using the current colors from Terminal-Icons (except for default folder), considering the limitations of PSANSIRenderingFileInfo (like you can't set colors for specific files or folder names etc). Here https://gist.github.com/rafma0/ba70b41e3a100b88307703408dd7a795

Interesting. I didn't think about the AV. I currently use Sentinel One which doesn't appear to be as bad as Windows Defender ( e.g. MsMpEng.exe ). I also used to use a VPN that had to go out of state. I'm also using the module PowerShellHumanizer. Lately, I deal with the slowness, but it really hasn't been as bad lately. I love the colors and "pretty" file sizes too much.

from terminal-icons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.