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)
- project with 10 files (4s -> 1.5s)
- project with 100 files: (8.7s -> 8.2s)
- project with 340 files: (21.5s -> 32s)