Skip to content

perf: parallelize scan stat pass, mmap dupe hashing, parallel dir removal (0.5.0) - #2

Merged
kingchenc merged 1 commit into
mainfrom
perf/parallelize-scan-dupes-delete
Jul 4, 2026
Merged

kingchenc merged 1 commit into
mainfrom
perf/parallelize-scan-dupes-delete

Conversation

@kingchenc

Copy link
Copy Markdown
Owner

Makes the whole pipeline parallel — no serial hot path left.

  • scan: the per-file size stat ran serially in the consumer loop even though jwalk walked in parallel — hundreds of thousands of stat syscalls on one thread was the whole scan cost. Moved into jwalk process_read_dir (WalkDirGeneric client_state) so sizes are read on the parallel walk workers; the consumer just reads the cached size.
  • dupes: full BLAKE3 hash now update_mmaps the file (blake3 mmap feature) — large files hash straight from the page cache, no buffered-read syscalls/copies. Streaming fallback for empty/special files.
  • delete: directory removal is no longer a serial loop — dirs grouped by depth, each level removed in parallel (siblings are independent), deepest first.

Bump 0.4.0 → 0.5.0. Compile-checked (core+cli); full build to CI.

… removal

The scan's per-file size stat ran serially in the consumer loop even though
jwalk walked in parallel, so hundreds of thousands of stat syscalls hit one
thread — the whole scan cost. Move the stat into jwalk's process_read_dir
(WalkDirGeneric client_state) so sizes are read on the parallel walk workers;
the consumer just reads the cached size. Nothing on the scan hot path is
sequential anymore.

- dupes: full BLAKE3 hash now memory-maps the file (update_mmap, blake3
  "mmap" feature) so large files hash straight from the page cache with no
  buffered-read syscalls or copies. Streaming fallback for empty/special files.
- delete: directory removal is no longer a serial loop — dirs are grouped by
  depth and each level is removed in parallel (siblings are independent),
  deepest level first so a dir is always empty when removed.

Bump 0.4.0 -> 0.5.0.
@kingchenc
kingchenc merged commit de2b559 into main Jul 4, 2026
@kingchenc
kingchenc deleted the perf/parallelize-scan-dupes-delete branch July 4, 2026 02:41
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.

1 participant