lsd icon indicating copy to clipboard operation
lsd copied to clipboard

lsd is slow Windows

Open lzybkr opened this issue 5 years ago • 8 comments

Performance is very slow - about 50 seconds to list a few files.

The long delay appears to be in calling lsd::meta::windows_utils::get_acl_access_mask.

Possibly relevant details - I'm testing on Win10 1903 on a domain joined machine. I suspect the issue is contacting the domain controller, because when I disconnect the machine from the network, lsd.exe gives me this error:

cannot access '.': The specified domain either does not exist or could not be contacted. (os error 1355)

I also tested on a non-domain joined machine (Server 2016) and it seemed plenty fast.

lzybkr avatar May 21 '19 01:05 lzybkr

Is windows even supported?

gchamon avatar May 21 '19 10:05 gchamon

Hi!

Is windows even supported?

Yep but it's in early stage for now. I will soon add some documentation into the README.

Peltoche avatar May 21 '19 10:05 Peltoche

Cool, because I was surprised to see Windows issues when I couldn't find anything in the readme. Nice! I will also try it in my secondary windows machine

gchamon avatar May 21 '19 10:05 gchamon

I tried in Windows and it is as fast as in WSL, sometimes faster. But I do sometimes come across the error cannot access '.' if -a is passed. This error also sometimes happen in WSL when accessing files in Windows.

Berrysoft avatar Jun 03 '19 05:06 Berrysoft

very very very slow in win 10, listing a directory with four sub-folders will cost one minute or more. In WSL, its speed is normal.

pplmx avatar Jan 28 '21 06:01 pplmx

Any news on this? The same directory works great in WSL but takes over 20s on Git Bash for me.

banjo avatar Apr 21 '21 06:04 banjo

I've ran a profiler at it and the problem is all the calls to GetEffectiveRightsForAclW:

image

santagada avatar Jul 05 '21 13:07 santagada

generally 1/10 speed of ls

ixzh avatar Jan 24 '22 22:01 ixzh

https://github.com/Peltoche/lsd/issues/817#issue-1605445446

This program has a severe performance problem on windows when the number of files to read is large (30+), it blocks almost 100ms untill it starts to render with Core::display, I dug on the issue and its located on the Win32 call to GetEffectiveRightsFromAclW, I don't know why is so expensive.

Proposed solutions:

  1. Figure out why that function call is so expensive (maybe we can't solve it)
  2. Be more inaccurate on windows about the permissions of the user and group (since its not very relevant on windows systems), for example the libcxx of llvm obtains the permissions of a file assuming its read only and then just checking if the property FILE_ATTRIBUTE_READONLY is set or not, assume that everything is executable and similar "inaccurate stuff"
  3. Change the creation of the Meta struct to only retrieve the owner/group permissions if its really needed to display

Hope this helps

@cdecompilador please discuss the performance issue on windows here

zwpaper avatar Mar 02 '23 03:03 zwpaper

https://github.com/Peltoche/lsd/pull/484 has some works in progress

zwpaper avatar Mar 02 '23 03:03 zwpaper

I don't know Rust, but is there anything i can do to help #484 go forward? It seems that the (last?) hang up is regarding the PR code coverage?

ArnaudKunzi avatar Mar 07 '23 12:03 ArnaudKunzi

hi @ArnaudKunzi, it seems there is not only the coverage, some discussions need to be resolved, and added some of mine just now, let's try to make it happen in the near future.

zwpaper avatar Mar 08 '23 03:03 zwpaper

Would that help if I tried to fork @vvuk's PR #484 and resubmit it with the requested changes? He doesn't seem to have much time at the moment. Not sure to get it right on the first try but it seems rather straightforward. I just don't want to cause unnecessary confusion/duplication and waste the maintainers time.

ArnaudKunzi avatar Mar 24 '23 09:03 ArnaudKunzi

Any progress on this issue?

marcotrosi avatar Aug 18 '23 10:08 marcotrosi

The PR needs to be rebased to the latest main branch version but I don't have sufficient knowledge to solve all conflicts and accommodate the other changes that happened since, so unless someone else fixes it, this is it.

ArnaudKunzi avatar Aug 18 '23 10:08 ArnaudKunzi

The PR needs to be rebased to the latest main branch version but I don't have sufficient knowledge to solve all conflicts and accommodate the other changes that happened since, so unless someone else fixes it, this is it.

have you asked for help/support from the other contributors?

marcotrosi avatar Aug 18 '23 10:08 marcotrosi

Even the latest lsd-1.0.0 the slowness is there:

PS> .\lsd.exe --version
lsd 1.0.0
PS> (Measure-Command { & .\lsd.exe }).TotalSeconds
14,4527767
PS> .\lsd.exe
 autocomplete   LICENSE   lsd.1   lsd.exe   README.md

ShrykeWindgrace avatar Aug 28 '23 08:08 ShrykeWindgrace

as v1.0.0 is finally released, I will spend some time on this, We may improve this step by step, but I can not guarantee any time schedule...

it's welcome for any PR improvement to be sent!

zwpaper avatar Aug 28 '23 10:08 zwpaper

I have a look at https://github.com/lsd-rs/lsd/pull/484, and it is not difficult to implement as an option, so I did a POC

Any comment is welcome, and we could do it in this way if it works for people who meet this problem.

zwpaper avatar Aug 28 '23 12:08 zwpaper

in my test. version: lsd 1.0.0 eza v0.18.0

=== on wsl2

time (lsd -alih --icon=always -R)

real    0m5.525s
user    0m1.701s
sys     0m1.268s

time (Downloads/eza -alih --icons=always -R)

real    0m12.055s
user    0m5.418s
sys     0m13.722s

=== on windows

Measure-Command { lsd -alih --icon=always -R }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 2
Milliseconds      : 996
Ticks             : 29965805
TotalDays         : 3.46826446759259E-05
TotalHours        : 0.000832383472222222
TotalMinutes      : 0.0499430083333333
TotalSeconds      : 2.9965805
TotalMilliseconds : 2996.5805

Measure-Command { eza -alih --icons=always -R }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 487
Ticks             : 4878319
TotalDays         : 5.6462025462963E-06
TotalHours        : 0.000135508861111111
TotalMinutes      : 0.00813053166666667
TotalSeconds      : 0.4878319
TotalMilliseconds : 487.8319

bingoct avatar Feb 04 '24 11:02 bingoct