-j not all it’s cracked up to be

I discovered that, at least on my uniprocessor test system, -j doesn’t make a speed difference for ‘make buildworld‘. The -jn flag creates nextra processes, and is supposed to speed the process up to some extent. I’d like if someone could show me a system where it does make a difference…

3 Replies to “-j not all it’s cracked up to be”

  1. Whether it makes a difference on a UP machine rather depends on what the bottleneck is and how the makefiles are structures.

    You need a workload where one gcc process will be able to be using the CPU whilst another one is blocked on IO. And you need plenty of opportunities in the makefiles (and I haven’t looked at the DFly makefiles) for parallelism to occur.

    It’s going to make more difference on SMP where you can actually have multiple CPUs running the process, though.

    I personally like to have 2 to 4 processes per CPU available. When doing development builds on my own projects, I used to use ccache, distcc (with 2 slave machines, as well as the local machine) and make -j24 or so. Some of the machines were also hyperthreaded…

  2. I’ve done timed runs on a few different systems, but they were all dual processor. On those various dual proc systems, I have always seen pretty substantial speed improvements, chopping off 20-40% of the build time when using -j.

    The sweet spot for most of my dual proc systems seems to be around -j8. Anything under 4 is substantially slower, 4-7 is slightly slower (by a few minutes at most, sometimes seconds), and I’ve found as I get over 8-10 on a dual proc system, things actually start to get a little bit slower.

    YMMV, of course. :)

  3. I tried some of those on my Pentium-m 1.4Ghz Laptop, and figured with -j5 I get the best results, with least time waiting for I/O. That was 62minutes for a buildworld with -j5 and more than 120 minutes without.

Comments are closed.