Skip to content

Instantly share code, notes, and snippets.

@BillAtHRST
Forked from jboner/latency.txt
Created May 31, 2012 16:21
Show Gist options
  • Select an option

  • Save BillAtHRST/2844543 to your computer and use it in GitHub Desktop.

Select an option

Save BillAtHRST/2844543 to your computer and use it in GitHub Desktop.
Latency numbers every programmer should know
"Magic" Numbers
Operation Time (us) Source
L1 cache reference 0.0005 2,3
Execute typical instruction 0.0010 2,3
Branch mispredict 0.0050 2,3
Propagation delay in fiber-optic cable, per meter 0.0050 5
L2 cache reference 0.0070 2,3
Mutex lock/unlock (uncontested) 0.0250 2,3
Decode FAST message 0.0500 5
Main memory reference 0.1000 2,3
One-way message send (kernel-bypass w/Infiniband & RDMA) 1.0000 5
Serialization delay (1500 bytes) ? 10Gb Ethernet 1.2000 5
Thread context switch in Linux (best case) 1.3200 6
Process context switch in Linux (best case) 1.5000 6
One-way message send (kernel-bypass w/10Gb & RDMA) 2.0000 5
Compress 1K bytes w/ cheap algorithm 3.0000 3
One-way message send (kernel-bypass w/Solarflare NIC) 4.0000 5
Serialization delay (1500 byte packet) ? 1Gb Ethernet 12.0000 5
Match marketable equity order 16.0000 5
Send 2K bytes over 1 Gbps network 20.0000 2,3
Roundtrip ? SDP on Infiniband 20.0000 4
Thread context switch in Linux (worst case) 30.0000 6
Roundtrip ? TCP over Infiniband 50.0000 4
Roundtrip ? TCP over 10Gb Ethernet 50.0000 4
Roundtrip ? TCP over 1Gb Ethernet 100.0000 4
Read 1 MB sequentially from memory 250.0000 2,3
Minimum Java GC pause time (IBM real-time GC) 250.0000 7
Round trip within same datacenter 500.0000 3
Disk seek 10,000.0000 3
Typical "average" Java GC pause time (???) 10,000.0000 ???
Read 1 MB sequentially from disk 20,000.0000 3
Send packet CA->Netherlands->CA 150,000.0000 2,3
Sources:
1."Software Optimization Resources", Agner Fog, http://agner.org/optimize
2."Teach Yourself Programming in Ten Years", Peter Norvig, http://norvig.com/21-days.html
3."Numbers Everybody Should Know", Manuel Simon,http://axisofeval.blogspot.com/2010/11/numbers-everybody-should-know.html
4."Latency Revisited", Cinnober,http://cinnober.com/sites/cinnober.com/files/news/Latency_revisited.pdf
5."Nanosecond Latency Management", Corvil, http://www.corvil.com
6."How long does it take to make a context switch", Benoit Sigoure,http://blog.tsunanet.net/2010/11/how-long-does-it-take-to-make-context.html
7."Metronome GC", IBM,http://domino.research.ibm.com/comm/research_projects.nsf/pages/metronome.metronomegc.html
@BillAtHRST

Copy link
Copy Markdown
Author

I've been keeping a version of these numbers for a while. Here's a list with original sources (as far as I could tell). It would be nice if this were up on a wiki somewhere...

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