Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Nov 2004 12:51:18 -0600 (CST)
From:      "Jon Noack" <noackjr@alumni.rice.edu>
To:        "Rob" <spamrefuse@yahoo.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: make -j$n buildworld : use of -j investigated
Message-ID:  <39182.69.53.57.66.1101235878.squirrel@69.53.57.66>
In-Reply-To: <41A2C5C0.3080908@yahoo.com>
References:  <41A2C5C0.3080908@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?39182.69.53.57.66.1101235878.squirrel>