Skip to content

perf: implement receiver quick-check to skip unchanged files - #2343

Merged
oferchen merged 1 commit into
masterfrom
perf/receiver-quick-check
Feb 18, 2026
Merged

oferchen merged 1 commit into
masterfrom
perf/receiver-quick-check

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Implement upstream rsync's quick-check algorithm (generator.c:617 quick_check_ok()) in the receiver's file transfer list construction
  • Compare destination size + mtime against source before entering the delta pipeline
  • When both match, skip the file entirely and apply metadata only (matching upstream set_file_attrs())
  • Add apply_metadata_with_cached_stat() to reuse the stat result from quick-check, halving stat syscalls for skipped files

Benchmark (10K files, loopback daemon, aarch64)

Metric Before After Improvement
Incremental (no change) 1,020ms 120ms 8.5x faster
vs upstream (146ms) 7.5x slower 1.22x faster
Syscalls (incremental) 394,320 10,261 38x fewer
vs upstream (10,445) 38x more fewer
Initial copy 512ms 582ms no regression
vs upstream (880ms) 1.17x faster 1.51x faster

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features --no-deps -D warnings
  • cargo nextest run --workspace --all-features — 21,724 passed
  • Benchmark: incremental sync 1.22x faster than upstream
  • Benchmark: initial copy no regression (1.51x faster than upstream)
  • Syscall count matches upstream (10,261 vs 10,445)

Add upstream rsync's quick-check algorithm (generator.c:617) to the
receiver's file transfer list construction. Before sending a file through
the delta pipeline, compare destination size + mtime against source. When
both match, skip the file and apply metadata only.

This eliminates the full pipeline for unchanged files: no signature
generation, no network round-trip, no temp file, no rename.

Also add apply_metadata_with_cached_stat() to reuse the stat result from
quick-check, halving stat syscalls for skipped files from 20K to 10K.

Benchmark (10K files, loopback daemon, aarch64):
- Incremental (no change): 1,020ms → 120ms (8.5x faster, 1.22x faster
  than upstream's 146ms)
- Syscalls: 394,320 → 10,261 (matching upstream's 10,445)
- Initial copy: no regression (1.51x faster than upstream)
@oferchen
oferchen merged commit 92d4e75 into master Feb 18, 2026
30 checks passed
@oferchen
oferchen deleted the perf/receiver-quick-check branch February 18, 2026 19:29
oferchen added a commit that referenced this pull request May 1, 2026
perf: implement receiver quick-check to skip unchanged files
oferchen added a commit that referenced this pull request May 5, 2026
perf: implement receiver quick-check to skip unchanged files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant