Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nahurst
Forked from jboner/latency.txt
Created September 13, 2012 01:34
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save nahurst/3711264 to your computer and use it in GitHub Desktop.
Save nahurst/3711264 to your computer and use it in GitHub Desktop.
Latency Numbers Every Programmer Should Know
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment