4 ms·
Before you get excited about unleashing the power of 16 cores on your desktop... I have recently upgraded from the 4-core to 6-core i7 with roughly the same fre
by old-gregg 9y ago
Before you get excited about unleashing the power of 16 cores on your desktop... I have recently upgraded from the 4-core to 6-core i7 with roughly the same frequency/turbo and noticed that compile times have actually increased.
Disappointing, I thought, especially because in addition to extra two cores I now sport a quad-channel DDR RAM. Well, turns out that compiling my Go projects does not generate enough "hot" threads, and the Linux scheduler keeps moving them around between 6 cores, letting the cores to "cool down" and drop to 1.2Ghz idle frequency. Meanwhile the 4-core box is happily spinning at 3.4-3.8Ghz during the compile cycle.
The only way to make the 6-core box to perform was to enable "performance" policy for intel_pstate which leads to the CPU running at its full speed even at idle (not great). Once I did that I saw the performance increase by 50%.
Here are the compile times of the same project on both machines with different CPU frequency scaling policies:
governor/cpu 4-core 3.4Gz 6-core 3.3Ghz
------------ ------------- --------------
standard 13 sec 15 sec
performance 11 sec 9 sec
As far as I know, AMD does not have an equivalent of intel_pstate in Linux kernel and relies on legacy ACPI governor which isn't as sophisticated as Intel's (where the CPU is more self-regulating) and I wonder what kind of effects to expect in regards to performance / power consumption if I go for Ryzen.
- Xeoncross 9y agoSolution: Keep all CPU's active. go build main.go & go build main.go & go build main.go & go build main.go & go build main.go & go build main.go & /s
- hinkley 9y agoI get that you're being funny, but there's a valid question in there. Does go not support parallel build jobs? If so then he should be setting the count to six instead.
- old-gregg 9y agoThe bigger question, at least for me, is either high-core machines improve your desktop experience if you're mostly running low-threaded workloads, for example a web browser. One humble piece of evidence I gathered says that no, more cores make your low-threaded applications run slower because the Linux scheduler keeps placing them onto "cold" cores running on idle frequency, and once they "spin up" the thread gets moved to another cold core.
- spatular 9y agoYou can also lower switching threshold, in my experience it helps: echo 50 >/sys/devices/system/cpu/cpufreq/ondemand/up_threshold
- mattkrause 9y agoPerhaps you could try setting the process affinity manually with taskset or numactl? Clearly it'd be nicer if the scheduler could figure this out automatically, but it might do in a pinch.
- GameOfTrolls 9y agoSo you're saying that software needs to be optimized for multi-core usage? Stop the presses. Have you submitted your work to Dr.Dobb's Journal yet? When can us mere plebs get in on a round of funding your startup? kys.