[Interest] Slow compiling on Mac

Konstantin Tokarev annulen at yandex.ru
Thu Aug 30 14:34:22 CEST 2012

30.08.2012, 16:04, "Thiago Macieira" <thiago.macieira at intel.com>:
> On quinta-feira, 30 de agosto de 2012 15.52.49, Konstantin Tokarev wrote:
>>  1. Compilation is not entirely CPU-bound process.
>>  2. OS scheduler is not perfect.
> The best performance ratio I can get on my dual core x dual thread machine is
> 375% CPU utilisation, so a -j4 would be recommended.
> However, I always build with -j5. My benchmarks show that from -j4 to -j6,
> there's minimal difference. if I add more, it starts to slow down again; if I
> use fewer, it idles.
> The rationale for using more than your number of CPUs is that there's a lot of
> I/O involved. Reading from disk is unbearably slow compared to other
> operations.
> I have an SSD, which means it's not that slow, so I don't gain much going from
> -j4 to -j5. But on a mechanical hard drive, that is more pronounced.

I guess that all of these facts apply to building on Linux. As for Mac, I have a feeling
that OS scheduler is somewhat more fair there, and complete CPU utilization is
achieved with lesser threads.


More information about the Interest mailing list