akrisanov
3/11/2018 - 4:09 PM

Latency Numbers Every Programmer Should Know

Latency Numbers Every Programmer Should Know

Tasknsusms
L1 cache reference0.5
Branch mispredict5
L2 cache reference714x L1 cache
Mutex lock/unlock25
Main memory reference10020x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy3,0003
Send 1K bytes over 1 Gbps network10,00010
Read 4K randomly from SSD*150,000150~1GB/sec SSD
Read 1 MB sequentially from memory250,000250
Round trip within same datacenter500,000500
Read 1 MB sequentially from SSD*1,000,0001,0001~1GB/sec SSD, 4X memory
Disk seek10,000,00010,0001020x datacenter roundtrip
Read 1 MB sequentially from disk20,000,00020,0002080x memory, 20X SSD
Send packet
CA->Netherlands->CA
150,000,000150,000150
  • 1 = 10^-9 seconds
  • 1 = 10^-6 seconds = 1,000 ns
  • 1 ms = 10^-3 seconds = 1,000 = 1,000,000 ns