Visualizing Latency Numbers Every Programmer Should Know

I recently saw Latency Number Every Programmer Should Know and was having trouble getting my head around the scale, so I made this visualization to help me out.

I converted latency times to their equivalent light distances (how far light travels in that much time) and plotted those distances on a map to get a sense of the latency numbers in relation to each other.

Source Data

The smallest few latency times are included here with their respective comparisons.

Latency Comparison Numbers Time Light Distance Approximate Light Distance
-------------------------- ---- -------------- --------------------------
L1 cache reference 0.5 ns 0.15 m Diagonal across your smartphone
Branch mispredict 5 ns 1.5 m Height of Natalie Portman
L2 cache reference 7 ns 2.1 m Height of Shaq
Mutex lock/unlock 25 ns 7.5 m Height of a school flag pole
Main memory reference 100 ns 30 m Half a Manhattan city block (North/South)
Compress 1K bytes with Zippy 3,000 ns 900 m Width of Central Park
Send 1K bytes over 1 Gbps network 10,000 ns 3,000 m Width of Manhattan
Read 4K randomly from SSD* 150,000 ns 45,000 m NYC to Hempstead on Long Island
Read 1 MB sequentially from memory 250,000 ns 75,000 m NYC to Princeton/Trenton, NJ
Round trip within same datacenter 500,000 ns 150,000 m NYC to Scranton, PA
Read 1 MB sequentially from SSD* 1,000,000 ns 300,000 m NYC to Boston, MA
Disk seek 10,000,000 ns 3,000,000 m NYC to Austin, TX
Read 1 MB sequentially from disk 20,000,000 ns 6,000,000 m NYC to Paris, France (also the diameter of the Earth)
Send packet CA->Netherlands->CA 150,000,000 ns 45,000,000 m Once around the equator
view raw latency.txt hosted with ❤ by GitHub

About me

My company runs "speed interviewing" events over video chat to connect developers and companies for face-to-face conversations. If you're interested in latency and performance, we're hosting a web-event Tuesday and would love to have you participate: Hirelite.com.