Since duration of an instruction is just the number of cpu cycles needed times the time of a cycle, which is the inverse of the frequency, I do not get why the ratio of cpu benchmark of a two processors of a same trademark is not exactly the inerse of the ratio of the frequencies. Cpu is supposed not to loose time by being inefficient but only to obey and realize the processors instructions that we ask, which are the same in a test of benchmark of the two processors. Could you enlight me ?
2 Answers
If processor A and processor B took exactly the same amount of processor cycles to do the same work, and processor B had exactly twice the clock speed of processor A, then the time for a benchmark running on processor B would be exactly half the time of the same benchmark running on processor A.
But they don't take exactly the same number of cycles.
One big effect is that historically, the speed of RAM hasn't increased as much as the speed of processors. On an Apple II computer, every memory access took exactly one processor cycle. On a modern desktop computer, a memory access takes in the order of 100 processor cycles. If processor B has twice the clock speed of processor A, but the RAM isn't twice as fast, then a benchmark will not run in half the time.
But on the other hand, there are effects that make modern processors take less cycles for the same work than older ones. Examples are:
Larger and larger RAM caches, which mean there is less use of slow RAM.
Vector units, which may process for example 16 byte operations or four double precision floating point operations just as fast as a single byte or floating point operation.
Multiple processing units; where the processor can decode and process multiple instructions in the same cycle.
Shortened latency; for example a floating point multiplication might take7 cycles on an older processor, 5 on a newer, and 3 on the latest processor.
64 bit operations, more registers: A modern processor can add two 64 bit numbers in a single operation, while an older processor would need multiple operations. More registers means that more values can be kept in registers and need not be loaded and stored to memory all the time.
And so on.
-
$\begingroup$ Thank you so much for the explanations $\endgroup$ Oct 26, 2019 at 7:32
Part of the benchmark might be limited by CPU time; other parts might be limited by IO or memory latency or other factors. Speeding up the clock frequency will speed up the first parts but not the second parts. As a result, doubling the clock frequency won't necessarily double the speed at which the benchmark is executed. So, the two ratios aren't necessarily equal.