Latency numbers every programmer should know

Source: cheat.sh
60 points by ksec a day ago on hackernews | 21 comments
# Latency numbers every programmer should know 

1ns                          Main memory reference:       Send 2,000 bytes             Read 1,000,000 bytes         
▗▖                           100ns                        over commodity network: 5ns  sequentially from SSD:       
                             ▗▖                           12.245us                     
L1 cache reference: 1ns                                                                ▗▖                           1.0us                        SSD random read: 16.0us                                   
                             ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗                          Disk seek: 1.649384ms        
Branch mispredict: 3ns                                                                 ▗▖▗                          
▗▖▗▖▗▖                                                    Read 1,000,000 bytes                                      
                             Compress 1KB wth Snappy:     sequentially from memory:    Read 1,000,000 bytes         
L2 cache reference: 4ns      2.0us                        741ns                        sequentially from disk:      
▗▖▗▖▗▖▗▖                     ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         358.968us                    
                             ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      Mutex lock/unlock: 16ns                                   Round trip                                                
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      in same datacenter: 500.0us  Packet roundtrip             
▗▖▗▖▗▖▗▖▗▖▗▖▗                10.0us = ▗▖                  ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         CA to Netherlands: 150.0ms   
                             ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
100ns = ▗▖                   ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         1.0ms = ▗▖                   ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
                                                          ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
# [github.com/chubin/late.nz] [MIT License]               ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
# Console port of "Jeff Dean's latency numbers"           ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖         
# from [github.com/colin-scott/interactive_latencies]     ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      
                                                          ▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖▗▖                                      

$
Follow @igor_chubin cheat.sh late.nz