Skip to content

Instantly share code, notes, and snippets.

@detro
Last active August 30, 2022 20:34
Show Gist options
  • Save detro/10c89f968d8d4070c9440ec92c51972c to your computer and use it in GitHub Desktop.
Save detro/10c89f968d8d4070c9440ec92c51972c to your computer and use it in GitHub Desktop.

Latency numbers (cheat sheet)

Operation nanosec microsec millisec notable 1Bx
L1 cache reference 0.5 ns 0.5 s
Branch mispredict 5 ns 5 s
L2 cache reference 7 ns 14x L1 cache 7 s
Mutex lock/unlock 25 ns 25 s
Main memory reference 100 ns 20x L2 cache, 200x L1 cache 1.6 m
Compress 1K bytes with Zippy 3,000 ns 3 µs 50 m
Send 1K bytes over 1Gbps net 10,000 ns 10 µs 5.5 h
Read 4K randomly from SSD 150,000 ns 150 µs ~1GB/s SSD 1.7 d
Read 1MB sequentially from mem 250,000 ns 250 µs ~4GB/s mem 2.9 d
Round trip within same datacenter 500,000 ns 500 µs 5.8 d
Read 1MB sequentially from SSD 1,000,000 ns 1,000 µs 1 ms ~1GB/s SSD (4x mem) 11.6 d
Disk seek 10,000,000 ns 10,000 µs 10 ms 20x datacenter roundtrip 16.5 w
Read 1MB sequentially from Disk 20,000,000 ns 20,000 µs 20 ms 50MB/s (80x mem / 20s SSD) 7.6 m
Send pack et CA->Netherlands->CA 150,000,000 ns 150,000 µs 150 ms 4.75 y

Note: the 1Bx column represents the values multiplied by 1 billion, to help mentally visualize the scale and proportions.

Notes

1 ns (nanosecond)  = 10^-9 s

1 µs (microsecond) = 10^-6 s  =     1,000 ns

1 ms (millisecond) = 10^-3 s  =     1,000 µs =     1,000,000 ns

1 s  (second)      = 1,000 ms = 1,000,000 µs = 1,000,000,000 ns

Credit

By Jeff Dean: http://research.google.com/people/jeff/

Originally by Peter Norvig: http://norvig.com/21-days.html#answers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment