Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54232

Use install rather than cp to copy files in buildsystem

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Backlog
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Build
    • Labels:
      None

      Description

      One of the weird things I learned while working on ninja is that install is significantly faster than cp. I don't know why this is, but it is reproducible across many systems and filesystems, etc. For example, this is running on a virtual workstation (c5.4xl ubuntu 18.04 xfs):

      ubuntu@ip-10-122-10-16:~$ dd if=/dev/zero of=src bs=1M count=100; sync;                          
      100+0 records in
      100+0 records out
      104857600 bytes (105 MB, 100 MiB) copied, 0.189798 s, 552 MB/s
      ubuntu@ip-10-122-10-16:~$ for i in `seq 10`; do time install src dest; done; sync;
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.064s
      user    0m0.000s
      sys     0m0.064s
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.061s
      user    0m0.000s
      sys     0m0.061s
       
      real    0m0.060s
      user    0m0.000s
      sys     0m0.061s
      ubuntu@ip-10-122-10-16:~$ for i in `seq 10`; do time cp src dest; done; sync;
       
      real    0m0.234s
      user    0m0.000s
      sys     0m0.071s
       
      real    0m0.226s
      user    0m0.004s
      sys     0m0.067s
       
      real    0m0.220s
      user    0m0.000s
      sys     0m0.073s
       
      real    0m0.211s
      user    0m0.000s
      sys     0m0.070s
       
      real    0m0.223s
      user    0m0.000s
      sys     0m0.075s
       
      real    0m0.335s
      user    0m0.000s
      sys     0m0.075s
       
      real    0m0.400s
      user    0m0.000s
      sys     0m0.073s
       
      real    0m0.400s
      user    0m0.004s
      sys     0m0.066s
       
      real    0m0.398s
      user    0m0.000s
      sys     0m0.073s
       
      real    0m0.399s
      user    0m0.000s
      sys     0m0.070s
      

      I have tried on my laptop (WSL2 + Arch ext4 on nvme) and the results were similar. Including the weirdness of later runs of cp being slower than earlier runs. �

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-devplatform Backlog - Server Development Platform Team (SDP)
              Reporter:
              redbeard0531 Mathias Stearn
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: