Search topics and sections

Computer performance is the amount of useful work a computer does in a given time, compared with the resources it uses, such as energy and money. It is usually measured as response time, how long one task takes, or throughput, how many tasks finish per unit of time, such as transactions per hour.[1] Engineers compare machines by running standard test programs called benchmarks.[2]

No single number fully describes performance. Speed depends on the algorithm (the set of steps used to solve a problem), the programming language, the compiler, the processor, the memory, and the input and output (I/O) system.[1]

Response time and throughput

Response time and throughput can change separately. Adding more parts, such as more disks, memory modules, or processors, multiplies bandwidth (the rate at which work or data moves) without making any single task finish sooner.[3] A faster part, by contrast, can shorten each task and also raise the total rate.

Latency and throughput on a timeline T1 T2 T3 T4 T1 T2 T3 T4 T1 T2 T3 T4 time 0 1 2 3 4 One server Four servers One server, twice as fast latency 1 per task throughput 1 task per unit latency 1 per task throughput 4 tasks per unit latency 0.5 per task throughput 2 tasks per unit
The same four tasks run on one server, on four servers, and on one server twice as fast. Four servers raise throughput to 4 tasks per unit but leave latency at 1 per task. The faster server halves latency to 0.50.5 and doubles throughput to 2 tasks per unit.

Comparing two computers

Performance is defined as the inverse of execution time, so a shorter time means higher performance.[1] Saying "X is nn times faster than Y" means:

PerformanceXPerformanceY=Execution timeYExecution timeX=n\frac{\text{Performance}_X}{\text{Performance}_Y} = \frac{\text{Execution time}_Y}{\text{Execution time}_X} = n

For example, if a program takes 10 seconds on computer A and 15 seconds on computer B, then A is 15/10=1.515/10 = 1.5 times faster than B.[1]

Wall-clock time and CPU time

Two kinds of time are used to measure a job.[1] CPU time is split further into user CPU time and system CPU time.[1]

Measure Includes Leaves out
Elapsed time (wall-clock time) All response time: processing, I/O, operating system overhead, and idle time Nothing
CPU time Only the time the processor spends on the given job I/O waits and time given to other jobs

Common metrics

Different parts of a system are rated with different metrics. The table lists several of them.

Metric What it measures Typical unit
Execution time Time to finish one task seconds
Throughput Work finished per unit of time[2] jobs per hour, requests per second
Latency Delay before one operation completes, such as a memory access seconds
Bandwidth Data moved per unit of time, as in memory bandwidth and network throughput bytes per second
Instructions per second Machine instructions run per second MIPS (millions of instructions per second)
FLOPS Floating-point arithmetic operations per second GFLOP/s (billions of floating-point operations per second)
IOPS Storage read and write operations completed per second[4] operations per second
CPI and IPC Average clock cycles per instruction, or instructions per cycle cycles per instruction, or instructions per cycle
Cycles per byte Clock cycles spent per byte of data processed, often used for cryptographic code[5] cycles per byte
Performance per watt Work done per unit of power operations per second per watt
Memory footprint Physical memory a program uses or references while it runs[6] bytes

The processor performance equation

The time a processor needs to run a program is the product of three factors.[7] This is often called the iron law of processor performance:

CPU time=IC×CPI×Tc=IC×CPIfclock\text{CPU time} = \text{IC} \times \text{CPI} \times T_c = \frac{\text{IC} \times \text{CPI}}{f_{\text{clock}}}
  • IC\text{IC} (instruction count) is the number of machine instructions the program executes.
  • CPI\text{CPI} (cycles per instruction) is the average number of clock cycles each instruction takes.
  • TcT_c is the clock cycle time, the length of one clock tick.
  • fclock=1/Tcf_{\text{clock}} = 1/T_c is the clock rate. A 2 GHz processor has a cycle time of 0.5 nanoseconds.[7]
The processor performance equation Instruction count × CPI × Clock cycle time = Instructions per program Cycles per instruction Seconds per cycle CPU time Algorithm Programming language Compiler Instruction set architecture Processor hardware Affects May affect
The processor performance equation splits CPU time into instruction count, cycles per instruction (CPI) and clock cycle time: CPU time=Instruction count×CPI×Clock cycle time\text{CPU time} = \text{Instruction count} \times \text{CPI} \times \text{Clock cycle time}. Arrows show which layers of a computer system affect each factor; a dashed arrow means the layer may affect it.

What affects each factor

Each layer of the system changes one or more of the three factors.[1]

Layer Instruction count CPI Clock cycle time
Algorithm yes possibly
Programming language yes yes
Compiler yes yes
Instruction set architecture yes yes yes
Processor hardware yes yes

The average CPI is set by the processor hardware, and it depends on the mix of instructions a program uses.[1]

Hardware designers often have to trade clock rate against the number of cycles.[1]

Worked example

Two computers run the same instruction set, so a program has the same instruction count II on both.[1] Times are given in picoseconds (ps), or trillionths of a second.

  • Computer A has a cycle time of 250 ps and a CPI of 2.0. Its CPU time is I×2.0×250 ps=I×500 psI \times 2.0 \times 250\ \text{ps} = I \times 500\ \text{ps}.
  • Computer B has a cycle time of 500 ps and a CPI of 1.2. Its CPU time is I×1.2×500 ps=I×600 psI \times 1.2 \times 500\ \text{ps} = I \times 600\ \text{ps}.

Computer A is faster by 600/500=1.2600/500 = 1.2 times, even though B needs fewer cycles per instruction.

Why clock rate and MIPS mislead

Clock rate alone does not set speed, because the equation also depends on instruction count and CPI. MIPS (millions of instructions per second) has a similar flaw:[1]

MIPS=ICExecution time×106=fclockCPI×106\text{MIPS} = \frac{\text{IC}}{\text{Execution time} \times 10^6} = \frac{f_{\text{clock}}}{\text{CPI} \times 10^6}

MIPS ignores differences between instruction sets and differences in how much work each instruction does. CPI also varies between programs on the same processor, so one MIPS rating does not hold for all programs.[1]

IPC (instructions per cycle) is the inverse of CPI. The Linux perf stat tool reports it directly, for example as "1.36 insn per cycle" for a software build.[8]

Amdahl's law

Amdahl's law says that the overall gain from speeding up one part of a job is limited by the share of time that part takes. If a fraction ff of a computation is sped up by a factor SS, the overall speedup is:[9]

Speedup(f,S)=1(1−f)+fS\text{Speedup}(f, S) = \frac{1}{(1 - f) + \dfrac{f}{S}}
  • ff is the fraction of the original execution time that the enhancement affects, with 0≤f≤10 \le f \le 1.
  • S>0S > 0 is how many times faster the enhanced part runs.

As SS grows without limit, the speedup can never exceed 1/(1−f)1/(1-f). The unimproved part sets the limit.[9]

Example

Suppose a program runs for 100 seconds, and multiplication takes 80 of them.[1] Making multiplication nn times faster gives a new time of 80/n+2080/n + 20 seconds.

A fivefold overall speedup would need a total of 20 seconds. That would require multiplication to take no time at all, so it cannot be done.[1]

The general lesson, often stated as "make the common case fast", is that optimizations have little effect when ff is small.[1][9]

Parallel processors

Gene Amdahl made his argument in 1967 about using many processors at once.[9] He assumed a fraction ff of the time could be split across nn processors with no overhead and the rest ran in sequence. He did not write an equation, but his argument gives the formula above with S=nS = n.[9]

The result limits parallel computing and multicore chips. If 10% of a task is serial, the most parallelism can give is a speedup of 10, no matter how many cores the chip has.[10]

The serial part also costs energy. Each active core uses power whether or not it helps, so cores that wait on serial code waste energy.[11]

Amdahl's law speedup versus number of processors 1 4 16 64 256 1024 number of processors n speedup 0 20 40 60 80 100 f = 0.99 f = 0.95 f = 0.9 f = 0.5 limit 1/(1-f) limit 1/(1-f) limit 1/(1-f) limit 1/(1-f)
Amdahl's law speedup Speedup(f,n)=1/((1−f)+f/n)\text{Speedup}(f, n) = 1/((1-f) + f/n) for four parallel fractions ff, plotted against processor count nn on a logarithmic scale, where equal steps along the axis multiply nn by the same amount. Each curve levels off at its limit 1/(1−f)1/(1-f), which is 100, 20, 10, and 2 for ff = 0.99, 0.95, 0.9, and 0.5.

Scaled speedup

John Gustafson argued that Amdahl's formula assumes a fixed problem size, which is rarely how parallel machines are used.[12] In practice, users grow the problem to fit the larger machine, so the run time stays about constant instead.

He gave an alternative suggested by E. Barsis at Sandia National Laboratories, now known as Gustafson's law:[12]

Scaled speedup=N+(1−N) s′\text{Scaled speedup} = N + (1 - N)\, s'
  • NN is the number of processors.
  • s′s' is the fraction of time the parallel system spends on serial work.

On a 1024-processor machine, Gustafson's group reported speedups of 1021, 1020, and 1016 for three applications whose serial fraction was 0.4 to 0.8 percent.[12]

Latency, queues, and tails

Latency lags bandwidth

Across processors, memory, networks, and disks, bandwidth has improved much faster than latency since 1980.[3] David Patterson summed up the trend as a rule of thumb. In the time that bandwidth doubles, latency improves by no more than a factor of 1.2 to 1.4.[3]

Caching, replication (keeping copies of data or services on several machines), and prediction help systems cope with this gap.[3] Latency still matters for interactive use, where a quick and predictable response is key to productivity.[3]

Little's law

Little's law, a theorem of queueing theory, links throughput and latency. John Little published a proof in 1961.[13]

L=λWL = \lambda W
  • LL is the average number of requests in process.
  • λ\lambda is the average arrival rate of requests, in requests per second.
  • WW is the average response time per request, in seconds.

The law holds when these long-run averages exist and are finite, and it does not depend on the order in which requests are served.[13] For example, a server that receives 1,000 requests per second, each taking 0.05 seconds, has on average 1000×0.05=501000 \times 0.05 = 50 requests in progress.

Tail latency

Tail latency is the response time of the slowest requests, usually stated as a high percentile. The 99th-percentile latency is the time within which 99% of requests finish.

In large services, rare slow responses become common. In The Tail at Scale (2013), Jeffrey Dean and Luiz André Barroso described a server that usually responds in 10 ms but has a 99th-percentile latency of one second.[14] One request in 100 to that server is slow.

If a user request must wait for responses from 100 such servers in parallel, 63% of user requests take more than one second.[14] This follows from 1−0.99100≈0.631 - 0.99^{100} \approx 0.63. Even if only one in 10,000 requests is slow on each server, a service using 2,000 servers sees almost one in five user requests take more than one second.[14]

Tail latency with request fan-out1101001,00010,000Number of servers a request waits for0255075100User requests slower than 1 s (%)63%Almost 1 in 5Each serverslow 1 in 100Each serverslow 1 in 10,000
When a user request has to wait for NN servers, the share of slow requests is 100×(1−pN)100 \times (1 - p^N) percent, where pp is the chance that one server responds quickly. With one server in 100 slow, 63% of requests are slow at 100 servers. With one in 10,000 slow, almost 1 in 5 requests is slow at 2,000 servers (after Dean and Barroso, 2013).

Real measurements show the same effect. In one Google service, the 99th-percentile latency for one random request was 10 ms, but for all requests to finish it was 140 ms. Waiting for the slowest 5% of requests made up half of that total.[14]

Memory limits

A processor can compute no faster than it can get data. Two ideas describe this limit.

The memory wall

The memory wall is the point where memory speed, not processor speed, sets system performance. William Wulf and Sally McKee described it in 1995.[15]

They assumed DRAM performance would keep improving at 7% per year and projected processor speed growing at either 50% or 100% per year.[15] About 20% to 40% of instructions reference memory. Taking the lower figure, they reasoned that once the average memory access takes more than 5 instruction times, a faster processor no longer shortens run time.[15]

CPU caches delay this point but, in their predictions, do not remove it.[15]

The roofline model

The roofline model is a graph that shows the highest performance a program kernel (the main computation a program performs) can reach on a given machine. Samuel Williams, Andrew Waterman, and David Patterson introduced it in 2009.[16]

The model uses operational intensity, the number of operations per byte of traffic to main memory, after the caches have filtered it.[16]

The authors chose this over arithmetic intensity, which they describe as measuring traffic between the processor and cache.[16]

Attainable FLOP/s=min⁡(Peak FLOP/s, Peak memory bandwidth×Operational intensity)\text{Attainable FLOP/s} = \min\left(\text{Peak FLOP/s},\ \text{Peak memory bandwidth} \times \text{Operational intensity}\right)

On a log-log plot (a graph with logarithmic scales on both axes), this gives a slanted line (memory bound) that meets a flat line (compute bound). The meeting point is the ridge point, the lowest operational intensity at which a kernel can reach the machine's peak.[16]

Roofline model1/41/2124816Operational intensity (FLOPs per byte of DRAM traffic)Attainable performance (GFLOP/s)Peak memory bandwidth× operational intensityPeak floating-point performanceRidge pointMemory boundCompute boundKernel A(memory bound)Kernel B(compute bound)
Roofline model: attainable performance rises with operational intensity along the memory bandwidth slope, then levels off at peak floating-point performance after the ridge point. Kernel A, left of the ridge, is limited by memory bandwidth, and kernel B, right of it, is limited by compute.

The ridge point shows how hard a machine is to use well. In the original study, two x86 computers had ridge points of 4.4 and 6.7, but the tested kernels had operational intensities of only 0.25 to 1.64.[16]

Benchmarks

A benchmark is a fixed workload run to measure performance. SPEC lists the traits of a useful benchmark:[2]

  • It specifies a workload, a strictly defined set of operations.
  • It produces at least one metric, such as time or throughput.
  • It is reproducible, portable to many systems, and comparable across them.
  • It checks that the work was done correctly.
  • It has run rules that say which hardware, software, and tuning are allowed.

SPEC

The Standard Performance Evaluation Corporation (SPEC) is a major benchmarking organization. It became a corporation on November 14, 1988.[17]

Its first CPU suite, SPECmark (later called SPEC CPU89), came out in 1989 with 10 programs and a VAX 11/780 as the reference machine.[17] SPEC CPU2017 has 43 benchmarks in four suites.[17]

How SPEC CPU scores are computed

SPEC CPU2017 reports two kinds of score.[2]

SPECspeed SPECrate
Measures Time Throughput
Copies run One of each benchmark As many as the tester picks
Ratio per benchmark reference time / measured time copies × (reference time / measured time)
Higher score means Less time needed More work per unit of time

The ratios are combined with the geometric mean:[2]

Score=(∏i=1nri)1/n\text{Score} = \left( \prod_{i=1}^{n} r_i \right)^{1/n}

Here rir_i is the ratio for benchmark ii and nn is the number of benchmarks. Because of this math, two systems keep the same ratio to each other no matter which reference machine is used.[2] For example, a reference machine ran one benchmark in 1,775 seconds and a test system took about 354 seconds, giving a ratio of about 5.[2]

Load testing

Servers are often measured by load testing, which sends many simulated user requests and records throughput and response times. Locust is one open-source tool for this. It tests HTTP and other protocols, and users write test scenarios in Python.[18]

Finding bottlenecks

Profiling and hardware counters

Profiling finds where a program spends its time, often by sampling what the processor is running at timed intervals.[19]

Hardware performance counters are registers in the processor that count low-level events. Examples are CPU cycles, instructions retired, memory stall cycles, and cache misses.[19] Thousands of events exist, but only a few can be counted at once because the counters are a limited set of registers.[19]

Counters support top-down analysis. On supported processors, perf stat --topdown splits cycles into four groups:[8]

  • Frontend bound: the processor cannot fetch and decode instructions fast enough.
  • Backend bound: computation or memory access is the bottleneck.
  • Bad speculation: cycles wasted on branch mispredictions (when the processor guesses the wrong path of code to run next) and similar issues.
  • Retiring: useful work with no clear bottleneck.

The USE method

The USE method, from performance engineer Brendan Gregg, is a checklist for whole systems. For every resource, such as CPUs, disks, and buses, check three things:[20]

  • Utilization: the average time the resource was busy doing work.
  • Saturation: how much extra work the resource cannot yet serve, often seen as a queue.
  • Errors: the count of error events.

Low average utilization does not rule out saturation. Utilization measured over seconds or minutes can hide short bursts at 100%.[20]

Energy and cost

Performance is often judged per unit of power or per unit of money, not only per unit of time.

Performance per watt

SPECpower_ssj2008, released in 2007, was the first industry-standard benchmark to measure power use alongside performance for servers.[17] It runs a server at load levels from 0% to 100% in 10% steps and divides the total operations per second by the total power across all levels.[1]

Servers often waste power when lightly loaded. One AMD Opteron X4 server drew 295 W at full load and 180 W at 10% load, about 61% as much.[1] Google data centers mostly run at 10% to 50% load, so this idle power matters.[1]

Koomey's law

Koomey's law describes the long-term rise in computing's energy efficiency. A 2011 study led by Jonathan Koomey found that computations per unit of electricity doubled about every 1.57 years, a trend running back to the first computers.[21]

Grosch's law and Pollack's rule

Two older rules link performance to cost and chip size.

  • Grosch's law, stated by H. R. J. Grosch in 1953, says performance equals a constant times price squared. It was roughly true then and led to the idea that large computers cost less per operation. Large-scale integration (LSI), which puts many electronic components onto one chip, later made the law almost entirely stop holding.[22]
  • Pollack's rule, from Intel engineer Fred Pollack, says processor performance is roughly proportional to the square root of its area. Parts such as issue logic (the hardware that chooses and sends instructions to be run) and caches do not scale linearly with area, and wiring takes a growing share of the chip.[23]

Historical growth

Single-processor performance grew at very different rates in different eras. Hennessy and Patterson measured it with the SPEC integer benchmarks, relative to the VAX 11/780.[10]

Period Growth per year Main cause
Before mid-1980s about 22% Mostly better technology
1986 to 2003 about 52% New architecture ideas, best shown by RISC (reduced instruction set computing, processor designs based on a simpler set of instructions)
2003 to 2011 23% Power limits and limits on instruction-level parallelism (a processor running more than one instruction at a time)
2011 to 2015 under 12% Partly the limits of Amdahl's law
Since 2015 3.5% End of Moore's law
Annual growth in single-processor performance by era 0 20 40 60 performance growth per year (%) 22% 52% 23% under 12% 3.5% before mid-1980s 1986 to 2003 2003 to 2011 2011 to 2015 since 2015 technology RISC-era architecture power and ILP limits Amdahl's law limits end of Moore's law
Annual growth in single-processor performance on SPEC integer benchmarks, relative to the VAX 11/780, by era (after Hennessy and Patterson). Growth peaked at about 52% per year from 1986 to 2003 and has fallen to about 3.5% per year since 2015.

Two trends drove the fast years.

  • Moore's law began as Gordon Moore's 1965 prediction that transistors per chip would double every year. The prediction was changed in 1975 to every two years.[10]
  • Dennard scaling said power per transistor would fall as transistors shrank, so power per area stayed about constant.[11]

Sources date the end of Dennard scaling differently. Hennessy and Patterson's textbook places it around 2004, when Intel canceled its high-performance single-core projects and turned to multiple cores per chip.[10] Their 2019 article, based on their Turing Award lecture, says Dennard scaling began to slow sharply in 2007 and faded to almost nothing by 2012.[11]

With these trends gone, they argue that faster gains will need new architectures that use chips more efficiently.[11] For a sense of scale across machines, see computer performance by orders of magnitude.

References

  1. CS161 Design and Architecture of Computer Systems: Performance Evaluation, University of California, Riverside, 2016.
  2. SPEC CPU2017 Overview, Standard Performance Evaluation Corporation, 2017.
  3. Latency Lags Bandwidth, David A. Patterson, Communications of the ACM, 2004.
  4. What is IOPS?, Micron Technology.
  5. BLAKE2: simpler, smaller, fast as MD5, Jean-Philippe Aumasson et al., Cryptology ePrint Archive, 2013.
  6. Results for the Memory Footprint assessment, Microsoft Learn.
  7. Basic performance metrics: CPU time, CPI, MIPS, University of Vermont.
  8. perf-stat(1) Linux manual page, man7.org.
  9. Amdahl's Law in the Multicore Era, Mark D. Hill and Michael R. Marty, IEEE Computer, 2008.
  10. Computer Architecture: A Quantitative Approach, 6th edition, John L. Hennessy and David A. Patterson, Morgan Kaufmann, 2019.
  11. A New Golden Age for Computer Architecture, John L. Hennessy and David A. Patterson, Communications of the ACM, 2019.
  12. Reevaluating Amdahl's Law, John L. Gustafson, Communications of the ACM, 1988.
  13. Little's Law as Viewed on Its 50th Anniversary, John D. C. Little, Operations Research (reprint), 2011.
  14. The Tail at Scale, Jeffrey Dean and Luiz André Barroso, Communications of the ACM, 2013.
  15. Hitting the Memory Wall: Implications of the Obvious, Wm. A. Wulf and Sally A. McKee, ACM SIGARCH Computer Architecture News, 1995.
  16. Roofline: An Insightful Visual Performance Model for Multicore Architectures, Samuel Williams, Andrew Waterman, and David Patterson, Communications of the ACM, 2009.
  17. The SPEC 30th anniversary: SPEC 30-year time line, Standard Performance Evaluation Corporation, 2018.
  18. Locust, locustio, GitHub.
  19. Linux perf Examples, Brendan Gregg.
  20. The USE Method, Brendan Gregg.
  21. New 'Koomey's Law' of power efficiency parallels Moore's Law, Phys.org, 2011.
  22. Grosch's law, A Dictionary of Computing, Oxford University Press.
  23. Trends in Processor Architecture, Antonio González, Universitat Politècnica de Catalunya.

Figure