Comments (11)
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.
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.
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.
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.
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.
Thanks for the issue @marrsalles.
I'm not able to reproduce the extreme latency you're seeing. Here is what I did:
- Create Azure storage account with SMB file share in
eastus
(which has about 75ms latency for me). - Mounted file share as
z:
drive - Created 100 directories
- 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.
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.
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.
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.
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.
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 withls | fw
or I unload the module and tryls
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)
- Provide color to the entire line and not just the filename and icon
- Alignment issues in some hosts with Format-Wide (May be Nerd Fonts V3 specific) HOT 3
- Icons not displaying correctly PS7 via Windows Terminal HOT 3
- [FEATURE] Add support for the .c++ and .cxx extensions for C++ files HOT 1
- Glyphs for Jenkinsfile (already supported by nerdfonts) HOT 2
- Fix `Terminal-Icons` for Nerd Fonts v3.0 HOT 1
- Treat OneDrive for Business folders like OneDrive
- Not all icons are being displayed correctly HOT 3
- Emoji-based icon themes HOT 3
- Still slow HOT 14
- Some icons don't show correctly HOT 8
- Getting error on importing the terminal icons module
- [bug/show-terminaliconstheme] Command displays default file icon on folders
- [Feature Request] Provide a hook to further process link path info
- Getting Error Import-PowerShellDataFile: Cannot generate a PowerShell object for a ScriptBlock evaluating dynamic expressions. After Running Import-Module -Name Terminal-Icons in Microsoft.PowerShell_profile.ps1 when you host used in Thai Regional format
- Import-Clixml Error when opening Terminal
- There is bug with using version 0.11, with some icons displaying as "?" HOT 3
- Import-Module Terminal-Icons breaks application of custom Format.ps1xml files (when loaded in VsCode)
- Why does some of my icons doesn't show? HOT 1
- cloud file losing identity
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terminal-icons.