Amdahl's law
Twice the cores rarely means twice the speed. Most programs have some work that can't be split: steps that wait for each other, or a sync where every core has to agree. Extra cores only speed up the rest. A program that spends a fraction s of its time on serial work runs 1 / (s + (1 − s) / N) times faster on N cores. Drag the numbers to see how much that serial part costs.
On
- Program A spends
1 of its time syncing. It runsfaster, and never more than . - Program B spends
5 of its time syncing. It runsfaster, and never more than .
With the cores on a linear scale, the ceilings take over: past a hundred cores or so, both lines are nearly flat.
With the cores on a log scale, every step to the right doubles them. That spreads out the first few dozen cores, where the two programs part ways.
Things to try
- Take the serial part away. Set A's syncing to 0%, and its line runs along the dashed one: N cores, N times faster. Now nudge it to 0.5%. Over the first few dozen cores almost nothing changes, and then the line bends over.
- Find the ceiling. With a fraction s of serial work, the speedup can never pass 1/s, the dotted line. At 5% that's 20×, whether you have 64 cores or a million.
- Count what the cores buy. Put B at 10% and drag the cores from 16 to 1,024. That's 64 times the hardware for about 1.5 times the speed.
- Compare small differences. 1% and 2% sound alike. Drag the cores past 100 and look how far apart they end up.
How it's built
- No script. Everything on this page is markup: two
<t-num>s for the serial fractions, one for the cores, and a<t-let>per program for its speedup. The colors come from thecolorattribute of each<t-num>, and the chart uses the same two. - Two charts, one set of rows. A
<t-let>computes both programs' speedups at 201 core counts, spaced evenly on a log scale. Two<t-obsplot>s draw those rows, and they differ only in their x-axis: linear, or log with a tick at every power of 2. Each chart redraws whensa,sborcoreschanges. The y-axis fits the ceilings, not the cores, so dragging the cores only moves the dots. - Wide ranges.
coresgoes from 1 to 1,024, so itspixels-per-stepis 1. Hold Shift with the arrow keys to step by 10.
Ported from the TangleSlider demo in wigglystuff.