Impact of hyperthreading on compiler performance?

Jay Conrod picture Jay Conrod · Jan 6, 2010 · Viewed 8.9k times · Source

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?

Answer

netvope picture netvope · Apr 2, 2010

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$