Opens in a new tab
Back to writing

Amdahl’s law

Make part of a program infinitely fast and the rest still sets the pace.

Amdahl’s law explains the limits of how much you can speed up a system by improving part of it. It says that even if you make one part of a system much faster, the total improvement depends on how much time that part originally took.

How it works

  • If 60% of the system can be made super fast (almost instant), 40% of the time is still spent on the other parts.
  • So, the total speedup is limited by that 40%.
  • The formula for speedup is:
    Speedup = 1 / ((1 − p) + p / s)
    where p is the fraction of the time that can be improved and s is how much faster that part gets.
  • As s grows without limit, p / s shrinks to zero, so the speedup approaches a ceiling of 1 / (1 − p).

An example

  • Imagine 60% of a task can be sped up to take no time. That leaves 40% of the task unchanged.
  • Using Amdahl’s law with p = 0.6:
    Speedup = 1 / (1 − 0.6) = 1 / 0.4 = 2.5×

No matter how fast you make that 60%, the speedup tops out at 2.5×.

It shows the diminishing returns of making only part of a system faster.