Estimates in perspective
easy 24 minThe reference numbers behind every estimate: how long memory, disks and networks take, how big common data is, how to turn days into seconds, and the powers of two.
See it run
The reference numbers, stretched until they can be felt, and what each gap decides.
Operations
The latency ladder
From the processor's cache to the other side of the world.
Step 1 of 6
L1 cache
| Place | Real time | If L1 took 1 second |
|---|---|---|
| L1 cache | 0.5 ns | 1 second |
| L2 cache | ||
| Memory | ||
| SSD | ||
| Hard disk seek | ||
| Across continents |
0.5 ns. Let us call it one second.
Step 1: L1 cache
NS = {"L1": 0.5, "L2": 7, "memory": 100, "SSD": 150_000, "disk seek": 10_000_000, "ocean": 150_000_000}def stretched(ns): return ns / 0.5 # seconds, if L1 took one- Scale
- 0.5 ns to 150 ms
- You leave with
- The size of each gap
Remember nanoseconds, then 100 ns, 100 µs, 100 ms: each is a thousand times the last.
In the real world
The same estimates in perspective doing real jobs. Pick one and step through it.
An order page is quick for the team and slow for customers abroad.
Step 1 of 4
In the office
- Of a 3 second budget
- 6 ms
Works for us
12 reads one after another, 0.5 ms each: 6 ms.
Step 1: In the office
Common mistakes
The bugs interviewers watch for, with the fix beside each.
Counting queries, not trips
criticalA query of 1 ms behind a trip of 69 ms costs 70. Optimising the query saves almost nothing.
Wrongfor item in items: load(item) # 40 tripsRightload_many(items) # 1 tripReading µs as ms
majorOne wrong prefix is a factor of a thousand: an SSD looks like a hard disk, or a cache like a database.
Wrongssd_ms = 100Rightssd_ms = 0.1 # 100 µsTrusting a 2009 number for a 2026 machine
minorBulk reads and SSDs are several times quicker now. Use the table for ratios and measure the rest.
Wrongassert read_1mb_ssd_ms == 1Rightmeasure() # then planUsing one latency as a percentile
majorThe table describes one quiet operation. Under load requests wait, and the slowest few wait longest.
Wrongp99 = db_latencyRightp99 = load_test().p99
Interview tips
How to explain it
- Rules of thumb for how long and how big.
- Ratios matter, digits do not.
- Distance is the one that stays.
Memory trick
- 100 ns memory, 100 µs SSD, about 100 ms ocean.
- L1, L2, RAM, SSD, HDD, network.
- Ten doublings are a thousand.
Reach for it when
- Choosing memory, disk or network.
- Counting calls between regions.
- Choosing the width of an id.
Be careful with
- Bits and bytes.
- GB and GiB in limits and bills.
- Averages where the slowest matter.