Repository navigation
perf: optimize large file copy with direct write and adaptive 1MB buffers - #2738
Merged
Merged
Conversation
For a 1GB file, the read/write fallback path now uses 1024 read+write pairs instead of 2048 with the previous 512KB maximum. Both the engine crate (local copy) and transfer crate (remote transfers) gain the new tier, keeping adaptive buffer sizing consistent across all transfer modes.
…stination When the destination file does not exist and neither --partial nor --delay-updates is active, write directly to the final path instead of creating a temp file and renaming. This eliminates two syscalls (temp-file create + rename) per file and avoids double inode allocation on filesystems like tmpfs. Also updates README.md: consolidates status table by component, adds What's New section for v0.5.9 changes since v0.5.8, trims interop and architecture sections for brevity, adds Elad to acknowledgements.
When --temp-dir is configured, always use the temp-file + rename pattern even for initial copies, so the user's staging directory preference is honored.
Upstream rsync's temp file + rename protects existing destinations from corruption on interruption. When no destination exists, there is nothing to protect - upstream's cleanup (unlink temp) produces the same outcome as our remove_incomplete_destination(). Direct write is therefore equally robust for initial copies. Guarded by: no existing file, no --partial, no --delay-updates, no --temp-dir. create_new(true) prevents races with concurrent writers. Also removes direct-write from README What's New since the performance difference is negligible for large files.
oferchen
added a commit
that referenced
this pull request
May 1, 2026
…fers (#2738) * perf: add 1MB buffer tier for files >= 256MB to reduce syscall count For a 1GB file, the read/write fallback path now uses 1024 read+write pairs instead of 2048 with the previous 512KB maximum. Both the engine crate (local copy) and transfer crate (remote transfers) gain the new tier, keeping adaptive buffer sizing consistent across all transfer modes. * perf: auto-enable direct write for initial copies without existing destination When the destination file does not exist and neither --partial nor --delay-updates is active, write directly to the final path instead of creating a temp file and renaming. This eliminates two syscalls (temp-file create + rename) per file and avoids double inode allocation on filesystems like tmpfs. Also updates README.md: consolidates status table by component, adds What's New section for v0.5.9 changes since v0.5.8, trims interop and architecture sections for brevity, adds Elad to acknowledgements. * style: fix cargo fmt formatting in adaptive buffer tests * fix: respect custom temp directory in direct-write path When --temp-dir is configured, always use the temp-file + rename pattern even for initial copies, so the user's staging directory preference is honored. * perf: direct write for initial copies with upstream robustness parity Upstream rsync's temp file + rename protects existing destinations from corruption on interruption. When no destination exists, there is nothing to protect - upstream's cleanup (unlink temp) produces the same outcome as our remove_incomplete_destination(). Direct write is therefore equally robust for initial copies. Guarded by: no existing file, no --partial, no --delay-updates, no --temp-dir. create_new(true) prevents races with concurrent writers. Also removes direct-write from README What's New since the performance difference is negligible for large files.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
…fers (#2738) * perf: add 1MB buffer tier for files >= 256MB to reduce syscall count For a 1GB file, the read/write fallback path now uses 1024 read+write pairs instead of 2048 with the previous 512KB maximum. Both the engine crate (local copy) and transfer crate (remote transfers) gain the new tier, keeping adaptive buffer sizing consistent across all transfer modes. * perf: auto-enable direct write for initial copies without existing destination When the destination file does not exist and neither --partial nor --delay-updates is active, write directly to the final path instead of creating a temp file and renaming. This eliminates two syscalls (temp-file create + rename) per file and avoids double inode allocation on filesystems like tmpfs. Also updates README.md: consolidates status table by component, adds What's New section for v0.5.9 changes since v0.5.8, trims interop and architecture sections for brevity, adds Elad to acknowledgements. * style: fix cargo fmt formatting in adaptive buffer tests * fix: respect custom temp directory in direct-write path When --temp-dir is configured, always use the temp-file + rename pattern even for initial copies, so the user's staging directory preference is honored. * perf: direct write for initial copies with upstream robustness parity Upstream rsync's temp file + rename protects existing destinations from corruption on interruption. When no destination exists, there is nothing to protect - upstream's cleanup (unlink temp) produces the same outcome as our remove_incomplete_destination(). Direct write is therefore equally robust for initial copies. Guarded by: no existing file, no --partial, no --delay-updates, no --temp-dir. create_new(true) prevents races with concurrent writers. Also removes direct-write from README What's New since the performance difference is negligible for large files.
2 tasks done
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.
Summary
--partial, no--delay-updates). Writes directly to final path, skipping temp-file creation and rename - eliminates 2 syscalls per file and avoids double inode allocation on tmpfs.Test plan