# Compilation speed dependent on CPU?

Is the speed of compiling software very dependent on the CPU? I know this question is a bit broad, but I'm to find an answer to the case described below.

If I download a software project that makes use of Node.js, TypeScript, and JavaScript and compile it running yarn it takes a certain duration on machine A and another duration on machine B. In my test case machine A is equipped with an Intel i5-4570 and machine B is equipped with an AMD Ryzen 5 1600x. Both have 16 GB RAM and both also have similar SSD drives in use.

Now, if I run the software compilation on both machines, machine A takes about 1:30min and machine B takes about 1:20min. Hence, machine B is not significantly faster, even though the CPUs are quite different in capability and get different scores according to CpuBenchmark:

The single core rating of both CPUs is quite similar at around 2000 Points, but when I run compilation all cores move up to 100% according to system power statistics.

I also checked the network usage, but doesn't move over 10kB/s and is therefore negligible. The RAM use fluctuates within about 1GB in both systems between 9GB and 10GB.

Now, as the expected results differ quite intensly to the reality, I obviously am missing a point. So, an experienced input of some of you guys would very much help.

Is there anything else I could measure? Is there anything I missed or maybe don't know and therefore should further test? I basically want to find out, why the Ryzen is not significantly faster than the Intel mentioned above.

• Much compilation is lexical analysis (shuffling characters around, much branching), and then futzing around with large linked data structures (much data shuffling between CPU and memory or even disk). The "computation" part is rather limited. System performance just can't be summarized in some magical score, it is inherently multidimensional. And each type of task stresses different dimensions. – vonbrand Jul 11 '18 at 13:20
• @vonbrand: Especially in this case, where there is no code generation and only a limited amount of optimization. TypeScript is so semantically close to its target language ECMAScript, that compilation is essentially just type checking and then erasing all types. "Minification" is just parsing, ɑ-renaming, and unparsing. There are no expensive whole-program optimizations with massive flow-graphs here. It's mostly text processing. – Jörg W Mittag Jul 12 '18 at 23:44

Things you are missing is

• RAM performance: Intel CPUs has lower memory latency, and compilation speed significantly depends on memory latencies
• Amount of cores/threads: each Ryzen core is slightly slower than Intel core, but it has 1.5x more cores, and each core can run 2 threads. This makes it 1.5x faster for ideal multi-threaded tasks (like benchmarks), but real programs may be not ideally scale from 4 to 12 threads
• SSD speed, in particular 4K IOPS (i.e. speed of reading many small files)

F.e. first test on this page compares C++ compile times on various Intel/AMD CPUs:

• 8700K: Intel 6-core
• 7820X: Intel 8-core with slower memory controller
• 2700X: AMD 8-core
• 2600X: AMD 6-core

As you can see, Intel 6 cores outperformed AMD 8 cores and even Intel's own 8 cores coupled with slower memory controller.