Uploaded image for project: 'Swift'
  1. Swift
  2. SR-11632

Higher maximum jobs (-j) lead to longer build time

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      • 8-core 2,4 GHz Intel Core i9 MacBook Pro
      • 16 GB RAM
      • Xcode 11.0
      • MacOS Mojave 10.14.6 (18G103)

      Description

      For a small target, where there are about 10-30 swift files, limiting the number of jobs to 4 passed to swiftc command (-j4) speeds up the overall building time.
      The dummy, sample project improves 15s -> 7s on a local machine, 8-code i9 MacBookPro.

      Steps to reproduce:

      • 8 cores machine is recommended (but 6 should expose an issue too)
      • Expand MaxJobs3.zip and call ./reproduce.sh
        This is what it does:
        • Clean relative/local DerivedData from any previous runs (no global DerivedData is used)
        • Performs the same command as Xcode incremental build three times with times summary:
          • first with -jNUMBER_OF_CORES
          • then with -j4
          • first with -jNUMBER_OF_CORES (just to demonstrate that there is no caching)
      • Time for the second run is signifficantly smaller (e.g. 13.524s -> 6.518s)

      Sample output (local machine):

      Building with 16 jobs...
      real	0m13.524s
      user	0m48.149s
      sys	1m6.364s
      
      Building with 4 jobs...
      real	0m6.518s
      user	0m12.253s
      sys	0m4.736s
      
      Building with 16 jobs...
      real	0m13.238s
      user	0m52.122s
      sys	1m5.685s
      

      This is observed only for small projects 10-30 files.

      Build times improvment -j16 vs -j4 for various project size:

      • project with 10 files (4s -> 1.5s)
      • project with 100 files: (8.7s -> 8.2s)
      • project with 340 files: (21.5s -> 32s)

        Attachments

        1. MaxJobs.zip
          34 kB
        2. MaxJobs3_11_3.zip
          63 kB
        3. MaxJobs3.zip
          46 kB

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            polac24 Bartosz Polaczyk
            Votes:
            2 Vote for this issue
            Watchers:
            13 Start watching this issue

              Dates

              Created:
              Updated: