make -j$n buildworld : use of -j investigated
Jon Noack
noackjr at alumni.rice.edu
Tue Nov 23 10:51:29 PST 2004
Rob wrote:
> I have tested following with FreeBSD 5.3-Stable.
>
> On several different PCs I have used
> make -j$n buildworld
> with $n ranging from 1 to 9.
>
> Although people suggest "-j4" as optimal in general
> case, I have come to a very different conclusion:
>
> 1) single CPU with enough RAM (2 GHz, 512 MB)
> there's no significant speed up in the range
> "-j1" to "-j9".
> So "-j1" is as good as "-j9".
>
> 2) single CPU with little RAM (333 MHz, 64 MB)
> speed slows down rapidly from "-j1" to "-j9",
> because of intensive swapping.
> So "-j1" performs best in this case.
>
> 3) dual CPU with enough RAM (2 x 800 MHz, 1GB)
> speed up by almost two from "-j1" to "-j2",
> but after that no noticeable speed up anymore.
> So "-j2" is as good as "-j9".
>
> ----------------------------------------
>
> With these simple tests, I come to the conclusion that
> "make -j$n buildworld" is best with n = number of CPUs.
> Does that make sense?
I believe the current recommendation for SMP machines is to use "-j(n+1)",
so I've been using "-j3" on my dual CPU machines. This ensures there is
always a task waiting to be executed when one of the CPUs completes a job.
Note that a parallel build (using "-j") can cause problems when compiling
some programs (in fact, it didn't work for the kernel last time I
checked).
For my UP machines I don't use "-j" at all. If you read the make(1) man
page, you'll note that omitting "-j" implies "-B". As you already found,
with a single CPU there is no speed gained by using "-j" and without it I
get the assurance of running in compatibility mode.
Jon
More information about the freebsd-stable
mailing list