Tools — Latency

Latency numbers in human time

Make one L1 cache hit last a second and watch the rest of the stack stretch into minutes, days and years. Bars are on a log scale.

  1. L1 cache reference 0.5 ns
    1 second
  2. Branch mispredict 5 ns
    10 seconds
  3. L2 cache reference 7 ns
    14 seconds
  4. Mutex lock/unlock 25 ns
    50 seconds
  5. Main memory reference 100 ns
    3.3 minutes
  6. Compress 1 KB 3 µs
    1.7 hours
  7. Send 1 KB over 1 Gbps 10 µs
    5.6 hours
  8. Read 4 KB randomly from SSD 150 µs
    3.5 days
  9. Read 1 MB sequentially from memory 250 µs
    5.8 days
  10. Round trip within same datacentre 500 µs
    12 days
  11. Read 1 MB sequentially from SSD 1 ms
    23 days
  12. Database indexed lookup (typical, varies) 2 ms
    46 days
  13. Disk (HDD) seek 10 ms
    231 days
  14. Read 1 MB sequentially from HDD 20 ms
    1.3 years
  15. Round trip California to Netherlands 150 ms
    9.5 years
  16. Cross-region API call (typical, varies) 200 ms
    13 years
  17. TLS handshake, about 2 round trips (typical, varies) 300 ms
    19 years
  18. Card authorisation, 1-3 s (typical, varies) 2 seconds
    127 years

Classic numbers after Jeff Dean and Peter Norvig, approximate. Rows marked "typical, varies" are extras. Bar length is log scale, so each step is roughly 10x.

Privacy

Runs in your browser. Nothing is sent anywhere or stored.

Questions

Where do these numbers come from?

They are the commonly circulated list "Latency Numbers Every Programmer Should Know", popularised by Jeff Dean and Peter Norvig. The values are order-of-magnitude approximations of older hardware, so treat them as a feel for the ratios, not a benchmark.

What does "1 s = L1" mean?

Every duration is multiplied by the same factor so that one L1 cache reference (0.5 ns) takes one second. Everything else keeps its real ratio to it, so a main memory reference becomes about 3 minutes and a round trip from California to the Netherlands about 9.5 years.

What are the rows marked typical?

Extras that are not in the classic list, such as a TLS handshake, a database lookup, a cross-region API call and a card authorisation. They are rough typical values and vary widely between systems.

Does this store anything?

No. It runs in your browser, makes no network requests and stores nothing.