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

Improve performance when using --long #251

Merged

Conversation

TomLonergan03
Copy link
Contributor

@TomLonergan03 TomLonergan03 commented Mar 8, 2024

Previously, the unix extended attributes are always read no matter what. This is maybe not ideal, as it is very expensive to call for files which we will not display and leads to significantly (~300x with level = 2) worse runtimes recursing large directories. This is fixed by only calling unix::Attrs::from when it is a file which is going to be displayed.

This is my first PR here, so if I've missed anything please let me know.

Rough benchmarks

These are run with the path being my home directory, which consists of (per erd) 11650 directories, 124225 files, and 132 links. The command run is time erd -l --no-config -L 2 ~ for both cases, and all times are averaged over 5 runs.

Before

Executed in 81.01 secs
usr time 10.83 secs
sys time 15.58 secs

After

Executed in 0.24 secs
usr time 0.56 secs
sys time 0.47 secs

@TomLonergan03 TomLonergan03 changed the title Fix poor performance when using --long Improve performance when using --long Mar 8, 2024
Previously, the unix extended attributes are always read no matter
what. This is not ideal, as it is very expensive to call for files
which we will not display and leads to significantly (~80x with level
= 2) worse runtimes recursing large directories. This is fixed by only
calling `unix::Attrs::from` when it is a file which is going to be
displayed.
@solidiquis
Copy link
Owner

Amazing thanks! I'll be sure to include this in v4 which I'm currently working on.

@solidiquis solidiquis merged commit ea26c0e into solidiquis:master Mar 13, 2024
2 checks passed
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 this pull request may close these issues.

2 participants