The word 'fast' is a trap
We finished the last guide by watching one instruction ride the fetch-decode-execute cycle from start to finish. Now zoom out: a real program runs billions of those cycles, and the question every engineer eventually asks is simply 'which machine is faster?' That word — fast — feels obvious, but it hides a trap. Faster at what? Finishing one job quickly, or finishing the most jobs per hour? Those are different goals, and a chip can win one while losing the other.
Architects split 'fast' into two precise ideas. Response time (also called latency) is how long one task takes from start to finish — the stopwatch on a single web request. Throughput is how much work completes per unit time — requests served per second. A motorbike has great response time for one rider; a bus has great throughput for a crowd. The honest first move is to say which one you actually care about, because the rest of the answer depends on it.
The iron law of performance
Here is the single most useful equation in all of computer architecture. The time the CPU spends on your program breaks cleanly into three factors — and they are the only three. This is the iron law of performance: CPU time = instruction count x CPI x cycle time. Read it slowly, because each factor is something a different person controls.
CPU time = (instructions / program) x (cycles / instruction) x (seconds / cycle)
\______ IC ______/ \______ CPI ______/ \__ cycle time __/
IC set by : algorithm + compiler + the ISA
CPI set by : the microarchitecture (pipeline, caches, ...)
cycle time set by : circuit design + manufacturing (= 1 / clock rate)
Notice: the units cancel. instr x (cycles/instr) x (sec/cycle) = seconds.Instruction count (IC) is how many machine instructions your program executes — set by your algorithm, your compiler, and the instruction set. CPI (cycles per instruction) is the average number of clock ticks each instruction needs — set by the microarchitecture, the internal design of how the chip executes. Cycle time is the length of one tick, the reciprocal of the clock rate (a 3 GHz clock has a cycle time of 1/3 ns ≈ 0.33 ns). To go faster you must shrink at least one factor without inflating the others — and that 'without inflating the others' is where almost every real-world fight happens.
A tiny worked example
Let's make it concrete. Suppose a program runs 2 billion instructions, the chip averages CPI = 1.5, and the clock is 2 GHz (cycle time = 0.5 ns). Multiply the three: CPU time = 2x10^9 x 1.5 x 0.5x10^-9 s = 1.5 seconds. Now a salesperson offers you a chip clocked at 4 GHz — twice the megahertz! — and you are tempted to assume it halves your time to 0.75 s. Do not.
- Read the iron law again: only cycle time changed (from 0.5 ns to 0.25 ns). IC and CPI are properties of the program and the microarchitecture, not the clock.
- But pushing the clock to 4 GHz usually forces design changes that raise CPI — say a deeper pipeline that stalls more, so CPI climbs from 1.5 to 2.4.
- New CPU time = 2x10^9 x 2.4 x 0.25x10^-9 s = 1.2 seconds. The 2x clock bought only a 1.25x speedup — and on a different workload it could even be slower.
Where the three factors fight each other
The reason performance is hard is that the three factors are coupled — push one down and another pops up. A complex instruction set might cut IC by doing more per instruction, but each instruction then takes more cycles, raising CPI. A simpler set raises IC but lets each instruction run leaner. This tug-of-war is exactly the old RISC versus CISC debate, and modern chips blur it: a x86 chip cracks complex instructions into RISC-like micro-ops internally, so it shows the world a rich instruction set while its guts behave simply.
CPI is also where memory hides. A program that streams through an array in order keeps the average CPI low because most accesses hit fast on-chip storage; a program that hops around memory randomly pays long waits that inflate CPI dramatically — same instruction count, same clock, yet many times slower. We will spend whole later guides on this, but the iron law already explains why: cache behaviour lives entirely inside the CPI term. Performance is rarely about doing fewer things; it is about not waiting.
One guiding heuristic ties it all together: make the common case fast. Don't agonise over an instruction that runs once; pour your effort into the loop that runs a trillion times. The same instinct warns against optimising a number that does not matter for your goal — a brilliant throughput trick is worthless if what your user feels is response time. Always tie the factor you are tuning back to the metric you actually care about.
Measuring honestly: benchmarks
Because no single number captures 'speed', architects measure with benchmarks: agreed-upon suites of real programs run under identical conditions. A standard like the SPEC suite bundles many diverse workloads precisely so that no one program can flatter a chip. Two warnings worth carrying for life. First, a benchmark that does not resemble your work tells you almost nothing about your work. Second, beware seductive ratios like MIPS (millions of instructions per second), which counts instructions, not useful work — a chip can score high MIPS by running many cheap, pointless instructions.
When you must boil a whole suite down to one number, summarise its speedup ratios with the geometric mean, not the plain average — the geometric mean is the honest way to combine ratios so that the choice of reference machine cannot tilt the result. This sounds pedantic until you realise that the wrong averaging method can reverse which chip 'wins'. Honest measurement is itself a skill, and treating it casually is how good engineers fool themselves.
Why hardware stopped getting free speedups
For decades the iron law had a generous benefactor. Moore's law — the observation that the number of transistors on a chip roughly doubles every couple of years — handed designers ever more transistors, and a partner rule made each one better too. Dennard scaling said that as transistors shrink, their power density stays constant, so you could raise the clock rate generation after generation without melting the chip. Cycle time fell for free; programs sped up while you slept.
Around 2005 the gift ran out. Dennard scaling effectively ended: transistors kept shrinking, but their power density no longer held constant, and pushing the clock higher made chips run too hot to cool. Cycle time stopped falling on its own. Moore's law itself is now slowing too. The iron law did not change — but its easiest knob, cycle time, jammed.
This is the single deepest reason the rest of this ladder exists. If you cannot make one core tick faster, you must instead lower CPI with cleverer pipelines, or spread the work across many cores and accelerators — which is exactly why multicore chips and GPUs took over after 2005. But more cores rarely means proportional speedup (a fact called Amdahl's law that we will meet later), and parallelism shifts the hard work onto the programmer. From here on, every architectural idea you learn is, in some sense, a response to this wall: the free lunch is over, and the iron law tells us precisely which factor we must now earn by design.