views:

284

answers:

2

Say we want to compile a large project (say GCC or the Linux kernel) as fast as possible. Does a CPU with hyperthreading capability (say an Intel Core i7) run the compiler any faster with hyperthreading enabled or disabled? Are there any published benchmarks that test this?

My understanding of hyperthreading is that each core can select instructions from two (or more processes). This usually makes the core more efficient since it's less likely that functional units will be idle. However, there's potential for a performance penalty since processes running on the same core share resources such as cache and may interfere with one another. Whether or not performance actually increases depends on the workload.

So for a compiler workload, does performance increase? If so, by how much?

A: 

It all depends on if the compiler is written to be multi-threaded or not. If it is, then definitely hyperthreading speeds things up a bit since then the OS can schedule different parts of the compiler's threads onto different cores. I agree with Ken that compilations generally are more I/O bound than processing intensive, so having a speedy hard-drive would be more of a necessity than a speedy processor with 100's of cores.

arabian tiger
How about if the compiler is invoked with make -j N (N being the number of logical processors)? I'm concerned that since distinct compiler processes don't share any data, they much actually reduce performance.
Jay Conrod
+3  A: 

Compiling coreutils-8.4 on Ubuntu 8.04 x86

Intel Atom 1.6 GHz with HT enabled:

~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make > /dev/null

real    2m33.375s
user    2m22.873s
sys     0m10.541s
~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make -j2 > /dev/null

real    1m54.707s
user    3m26.121s
sys     0m13.821s
~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make > /dev/null

real    2m33.372s
user    2m22.753s
sys     0m10.657s
~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make -j2 > /dev/null

real    1m54.851s
user    3m26.145s
sys     0m13.685s
~/coreutils-8.4$

So Hyper-Threading reduces the run time to 75%, which is equivalent to 33% more processing power. (I ran them twice to ensure that everything is in the memory cache.)

And here is a control experiment to show that make -j2 alone does not improve the speed for compiling coreutils-8.4 on Ubuntu 8.04 x86

Single-core Core 2 Quad 2.5 GHz VM (no HT):

~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make > /dev/null

real    0m44.453s
user    0m38.870s
sys     0m5.500s
~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make -j2 > /dev/null

real    0m45.131s
user    0m40.450s
sys     0m4.580s
~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make > /dev/null

real    0m44.621s
user    0m39.090s
sys     0m5.340s
~/coreutils-8.4$ make clean > /dev/null
~/coreutils-8.4$ time make -j2 > /dev/null

real    0m45.165s
user    0m40.390s
sys     0m4.610s
~/coreutils-8.4$
netvope
This is great. The control experiment shows that this really makes a difference. Thank you.
Jay Conrod