perf!: avoid unnecessary metadata during deletion - #397
Merged
Conversation
Byron
force-pushed
the
speed-up-deletions
branch
from
September 7, 2026 08:13
d13908b to
fdfd9b2
Compare
<!-- agent --> Deletion needs entry types, but every walk collected full sizes, timestamps, allocation information, and file identities. Add `Options::skip_metadata` and use directory-entry types without extra metadata lookups when available. macOS and Windows use standard enumeration for this mode; Windows roots query only attribute/tag information. Keep the native metadata readers for ordinary scans and preserve Windows verbatim-path handling. Drop per-entry deletion byte accounting. Successful removals use the existing scanned total; partial failures retain entry/error counts and display unknown bytes instead of collecting metadata solely for that notification. Local macOS/APFS release medians showed 0-11.5% lower deletion time, with wide-directory traversal up to 40% shorter; gains vary with tree shape. BREAKING CHANGE: dua-core `Entry::metadata` is now Option<io::Result<Metadata>>, and Options literals require `skip_metadata`. Default options continue to collect full metadata. Assisted-by: GPT 6.0 Co-authored-by: GPT 6.0 <codex@openai.com>
Byron
force-pushed
the
speed-up-deletions
branch
from
September 7, 2026 08:48
fdfd9b2 to
f643c74
Compare
Byron
marked this pull request as ready for review
September 7, 2026 08:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by
Codex.Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Deletion previously collected sizes, timestamps, allocation information, and file identities for every entry. It now requests only entry types and stops storing per-entry byte counts.
dua-core::Options::skip_metadataselects standard directory enumeration on macOS and Windows and skips per-entry metadata calls and metadata jobs on other platforms. Explicit Windows roots query only attributes and reparse tags. Symlinks remain untraversed, and Windows long/verbatim paths retain their existing handling. Directory symlinks and junctions use a non-recursiveremove_dirfallback on Windows; the expanded CI coverage exposed the previous use of the wrong removal API.Breaking change:
Entry::metadatais nowOption<io::Result<Metadata>>, andOptionsliterals needskip_metadata. Default options still collect full metadata. Successful deletion notifications use the existing scanned total; partially failed deletions report?bytes with their entry/error counts.Performance evaluation
Release-mode comparison against
115f7bb5on macOS 26.6.2, arm64, local APFS. Times are medians of seven measured runs after one warmup, with baseline/candidate order alternating. Fixture creation was outside the timer. The harness used each revision's deletion routine anddua-corewalker.These fixtures show up to 11.5% less deletion time and up to 40% less traversal time, with several cases effectively unchanged. File removal dominates total time. Linux and Windows performance was not measured locally.
Validation
make check-pre-pushpassed.cargo clippy --workspace --all-targets --all-features -- -D warningspassed.cargo check -p dua-core --all-targetspassed foraarch64-pc-windows-msvcandaarch64-unknown-linux-gnu.3f9652fa,d13908b4) and reported no actionable findings.cargo check --workspace --all-targets --target aarch64-pc-windows-msvclocally.Reported issue
Evaluate if deletions can be faster if they only obtain the information that's actually required, like the type of the entry. While on some platforms like linux it might make no difference, on others they may be more choice, like Windows and macOS.
It's fine to make it an officially breaking change in the dua-core library.