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?
The main conclusion is that hyperthreading wins handily, reducing the best-case build time from 11.75 minutes to 10.04 minutes: an improvement of 1 minute and 42 seconds.
If you're unsatisfied with the processing output of your computer, it might be time to hyper-thread your central processing unit's (CPU) cores. Hyper-threading can be a great way to improve the processing speed of your PC without having to go through a major hardware makeover.
Hyper-threading works by allowing each core in your CPU to do two actions at the same time. In turn, you get better processor performance since it's improving the CPU's efficiency. This way you can use more demanding apps or games at the same time.
In general, having 4 cores is better than having 2 cores with Hyper Threading. To get into the more specifics though it depends what CPUs you are comparing. If the Core i5 has a higher clockspeed, then in this situation when only 1 or 2 cores are being used, it will perform better than the Core i7.
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$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With