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

du: Reuse metadata from DirEntry where possible #6839

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

jesseschalken
Copy link
Contributor

@jesseschalken jesseschalken commented Nov 3, 2024

On Windows, the DirEntry object has metadata already loaded, so calling dir_entry.metadata() instead of fs::symlink_metadata(path) saves a syscall.

~1.29x speedup on my test directory.

Before

> cargo build --release
> measure-command { .\target\release\coreutils.exe du --apparent-size "test folder" }
TotalSeconds      : 12.0716311

After

> cargo build --release
> measure-command { .\target\release\coreutils.exe du --apparent-size "test folder" }
TotalSeconds      : 9.3127479

@jesseschalken jesseschalken changed the title Use metadata from DirEntry where possible du: Reuse metadata from DirEntry where possible Nov 3, 2024
Copy link

github-actions bot commented Nov 3, 2024

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@jesseschalken jesseschalken marked this pull request as ready for review November 3, 2024 14:11
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/rm/rm1 (passes in this run but fails in the 'main' branch)

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

@cakebaker cakebaker merged commit 3d4436a into uutils:main Nov 19, 2024
62 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR :)

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