How many processor cores does your machine have, and are they multi-threaded?
I have a 4-dual-threaded-core machine (and a solid-state disk and a lot of memory), and "-j 8" seems to run the CPU at about 100%. I don't know whether "number of threads" would be a good default in all cases - what you really want is to keep cranking up the number of jobs until things don't get faster, but that's a pain - but, if it is a good default, then
sysctl -n hw.logicalcpu
would give cores*threads-per-core (tested on Snow Leopard, Lion, and Mountain Lion; the script doesn't work on Leopard, as the versions of at least some of the software won't configure and build, and I gave up trying to make them build).
(I originally used -j 4, but then saw something about a multi-threaded version of the IBM System/360 Model 195 that noted that multi-threading can help deal with pipeline bubbles due to unpredicted or mispredicted branches, so I tried -j 8 and found the CPU was busier than with -j 4.)
hmm, there are many points discussed here:
- do we want to make a smart decision on the number of parallel make
jobs, possibly derived from the number of cores?
My personal opinion is yes. On OsX using the sysctl mentioned by Guy is
probably a good starting point. Adding my own experience you'll want to
oversubscribe the number of jobs over the number of cores a little bit,
so that when jobs are waiting for I/O action another job can use the
free CPU. With my personal experience calculating something like "number
of cores"*1.5 seems reasonable, because if you're waiting for the long
lasting build job on your desktop computer, you want some "juice" left
over for web browsing, email reading or whatever. (This applies to all
modern operating system, Windows, Linux, OsX)
- the other question is, which versions of OsX are we targetting for
developer support going forward. Personally I think no serious Wireshark
user will use an earlier version of OsX than 10.6, so we should be safe.
(personal note, my old MacBook Pro has two cores and no hyper-thread, so
personally I'm fine with 3 make jobs [note that this was the default in
the OsX build script for a long time])
--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org