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

dir_entry: Implement lscolors::Colorable #1148

Merged
merged 5 commits into from Oct 31, 2022
Merged

Conversation

tavianator
Copy link
Collaborator

Now we can finally avoid calling stat() unless actually necessary to color a path. For example, with LS_COLORS="ex=0:sg=0:su=0:st=0:ow=0:tw=0:"

Command Mean [ms] Min [ms] Max [ms] Relative
./fd-master . ~/code/linux -u -j1 --color=always 225.8 ± 6.4 209.1 231.6 1.60 ± 0.10
./fd-colorable . ~/code/linux -u -j1 --color=always 140.9 ± 8.3 122.6 150.0 1.00

And still a (slight) improvement with my default LS_COLORS:

Command Mean [ms] Min [ms] Max [ms] Relative
./fd-master . ~/code/linux -u -j1 --color=always 259.2 ± 5.6 243.5 265.4 1.02 ± 0.04
./fd-colorable . ~/code/linux -u -j1 --color=always 255.2 ± 7.5 238.0 262.4 1.00

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thank you for this (and the related work in lscolors)!

@sharkdp
Copy link
Owner

sharkdp commented Oct 24, 2022

I think this would be worth a ChangeLog entry.

src/dir_entry.rs Outdated Show resolved Hide resolved
@tavianator
Copy link
Collaborator Author

Doing colors in parallel is a gigantic win:

Command Mean [ms] Min [ms] Max [ms] Relative
./fd-master . ~/code/linux --color=always 272.8 ± 14.6 244.2 287.5 2.31 ± 0.15
./fd-colorable . ~/code/linux --color=always 118.0 ± 4.3 108.8 125.5 1.00

No significant difference without colors:

Command Mean [ms] Min [ms] Max [ms] Relative
./fd-master . ~/code/linux 144.5 ± 4.4 136.7 151.5 1.00
./fd-colorable . ~/code/linux 145.3 ± 3.7 138.2 150.9 1.01 ± 0.04

@sharkdp
Copy link
Owner

sharkdp commented Oct 31, 2022

Doing colors in parallel is a gigantic win:

Oh wow, very nice!

src/walk.rs Outdated Show resolved Hide resolved
src/config.rs Show resolved Hide resolved
@sharkdp sharkdp merged commit cd8ec44 into sharkdp:master Oct 31, 2022
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.

None yet

3 participants