Build time measurements: iMac Pro (2017) vs M1 Macbook Pro (2020)

Build machines:

  • iMac Pro: 3 GHz 10-Core Intel Xeon W with 64 GB 2666 MHz DDR4
  • Macbook Pro: M1 with 16 GB RAM

This is a recent build of main, with --release --no-assertions, no caching, and a warm disk buffer cache. There is some skew in CMake versions (3.17.3 on iMac Pro vs 3.19.6 on Macbook Pro) and Xcode versions (different betas of Xcode 12.5) as well, but I was too lazy to setup the exact identical versions.

Build parallelism

A large fraction of the build -- the compilation of C++ files -- is highly parallel. Some parts of the build take a non-trivial chunk of time, such as CMake and compiling the stdlib and overlays -- CMake runs serially from what I understand, the stdlib is compiled in WMO (so not parallel), I haven't checked if the overlays are compiled in parallel or not.

Clean build

iMac Pro
real 1732.06
user 27366.58
sys 1366.28

M1 Macbook Pro (plugged in)
real 1685.81
user 11850.63
sys 387.66

M1 Macbook Pro (94% charged, on battery, dropped to 82%)
real 1689.85
user 11788.06
sys 389.05

After this, I only made measurements with the Macbook Pro plugged in.

Incremental compiler build

I added a comment to Decl.h and recompiled the swift-frontend target (reusing completed build from earlier). This recompiles about 600 C++ files, and should be a highly parallel part of the build.

iMac Pro
real 348.12
user 6171.18                                                                                                                     
sys 289.58

Macbook Pro
real 371.30
user 2740.77
sys 83.16

Stdlib build

After the compiler was built from the previous part, I rebuilt the stdlib target using ninja. This part of the build should be fully serial.

iMac Pro
real 66.75
user 120.99
sys 3.36

Macbook Pro
real 43.43
user 79.15
sys 1.19

Dat M1!

How would sccache impact here? From what I know it should help with all build types, even clean.

1 Like

I get the following numbers.

iMac Pro (100% cache hit rate)
real 414.64
user 1273.49
sys 227.94

Macbook Pro (100% cache hit rate)
real 279.62
user 560.17
sys 81.63

This makes sense; sccache is accelerating C++ compilation, which is the highly parallel part of the build. Since the serial part of the build takes up a larger fraction of overall time, the M1 takes a strong lead due to significantly better single core performance.

1 Like
Terms of Service

Privacy Policy

Cookie Policy