Skip to content

Conversation

dspinellis
Copy link
Collaborator

No description provided.

This is more realistic and allows to benchmark copy_file_range(2)
performance.
Copy link

codecov bot commented Sep 20, 2025

Codecov Report

❌ Patch coverage is 0% with 200 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (7991910) to head (65d3197).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
src/uu/sed/src/fast_io.rs 0.00% 200 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main    #161    +/-   ##
======================================
  Coverage   0.00%   0.00%            
======================================
  Files         13      13            
  Lines       2729    2882   +153     
  Branches     240     254    +14     
======================================
- Misses      2729    2882   +153     
Flag Coverage Δ
macos_latest 0.00% <0.00%> (ø)
ubuntu_latest 0.00% <0.00%> (ø)
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dspinellis dspinellis force-pushed the copy-file-range branch 3 times, most recently from 7986758 to 2485a53 Compare September 20, 2025 08:37
@dspinellis dspinellis changed the title Use copy_file_range(2) for improved performance where possible Improve performance with copy_file_range(2) Sep 20, 2025
@dspinellis dspinellis force-pushed the copy-file-range branch 3 times, most recently from 4b07a7c to b9f4634 Compare September 22, 2025 12:07
On file systems supporting reflinks or extent remapping, such
as XFS, Btrfs, NFS, regions of files that are not modified are
processed without any copying — with O(1) cost.

While at it:

- Correct the use of write(2) to handle partial writes and
  report appropriate errors.

- Improve buffer sizing.

These are the benchmark results
           no-op-short copy-file-range is  1.17 times faster than main
      access-log-no-op copy-file-range is  2.91 times faster than main
   access-log-no-subst copy-file-range is  1.56 times faster than main
      access-log-subst copy-file-range is  1.03 times faster than main
     access-log-no-del copy-file-range is  1.59 times faster than main
    access-log-all-del copy-file-range is  1.06 times faster than main
   access-log-translit copy-file-range is  1.05 times faster than main
access-log-complex-sub copy-file-range is  1.04 times faster than main
     access-log-append copy-file-range is  1.05 times faster than main
             remove-cr copy-file-range is  1.03 times faster than main
          genome-subst copy-file-range is  1.08 times faster than main
            number-fix copy-file-range is  1.03 times faster than main
           long-script         main     is similarly fast as   copy-file-range
                 hanoi         main is  1.03 times faster than copy-file-range
             factorial copy-file-range is  1.03 times faster than main

On suported file systems (XFS, BTRFS), output files with no or few in-place
modifications share large blocks with the input file, as can be seen
in the following example.

$ xfs_io -c 'fiemap -v' lines.txt
lines.txt:
 EXT: FILE-OFFSET      BLOCK-RANGE         TOTAL FLAGS
   0: [0..857199]:     11917304..12774503 857200 0x2000
   1: [857200..857207]: 12774504..12774511      8   0x1
@sylvestre
Copy link
Contributor

ready for review ? :)

@dspinellis
Copy link
Collaborator Author

@sylvestre yes, ready, thanks!

@cakebaker cakebaker requested a review from sylvestre September 30, 2025 15:11
@sylvestre sylvestre merged commit 6519b3d into uutils:main Sep 30, 2025
18 checks passed
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