numbers-every-programmer-should-know
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| numbers-every-programmer-should-know [May 14, 2026 at 11:38] – external edit 127.0.0.1 | numbers-every-programmer-should-know [August 22, 2026 at 15:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| # Numbers every programmer should know | # Numbers every programmer should know | ||
| - | **Numbers every programmer should know** is a short document listing latencies of various computer operations. The list is given by a computer scientist [Jeff Dean](https:// | ||
| - | It illustrates how various high-level operations exponentially take longer time to perform compared to various low-level operations. | + | **[Numbers every programmer should know](https:// |
| - | ## Content | + | Based on Jeff Dean's seminal analysis; values evolve as technology changes. |
| - | - https:// | + | ## Example |
| - | ``` | + | Typical latency hierarchy |
| - | Latency Comparison Numbers | + | |
| - | ---------------------------------- | + | |
| - | L1 cache reference | + | |
| - | Branch mispredict | + | |
| - | L2 cache reference | + | |
| - | Mutex lock/ | + | |
| - | Main memory reference | + | |
| - | Compress 1K bytes with Zippy | + | |
| - | Send 1K bytes over 1 Gbps network | + | |
| - | Read 4K randomly from SSD* | + | |
| - | Read 1 MB sequentially from memory | + | |
| - | Round trip within same datacenter | + | |
| - | Read 1 MB sequentially from SSD* | + | |
| - | Disk seek | + | |
| - | Read 1 MB sequentially from disk 20, | + | |
| - | Send packet CA-> | + | |
| - | Notes | ||
| - | ----- | ||
| - | 1 ns = 10^-9 seconds | ||
| - | 1 us = 10^-6 seconds = 1,000 ns | ||
| - | 1 ms = 10^-3 seconds = 1,000 us = 1,000,000 ns | ||
| - | |||
| - | Credit | ||
| - | ------ | ||
| - | By Jeff Dean: | ||
| - | Originally by Peter Norvig: http:// | ||
| - | |||
| - | Contributions | ||
| - | ------------- | ||
| - | ' | ||
| - | Visual comparison chart: | ||
| - | Interactive Prezi version: https:// | ||
| ``` | ``` | ||
| - | + | L1 cache reference: | |
| - | ## Criticism (Opinion) | + | L2 cache reference: |
| - | While the list is illustrative, | + | Main memory reference: |
| - | + | Mutex lock/unlock: 100 ns | |
| - | The list mixes different categories of programming which sit at completely different hierarchies. A high-level web programmer almost never needs to know about mutex lock/ | + | Compress 1K with Zippy: |
| - | + | Network SSD read (4K): 150,000 ns | |
| - | In addition, these numbers evolve as the technology continues to evolve. Because we're talking about latencies, they are subjected to eternal factors | + | Disk seek: 10,000,000 ns |
| - | + | Network RTT CA↔NL: | |
| - | As mentioned, the list should only be understood as illustrative. | + | |
| ``` | ``` | ||
| - | L1 cache < Branch mispredict < ... < Send packet CA -> Netherlands -> CA | ||
| - | ``` | ||
| - | |||
numbers-every-programmer-should-know.1778758708.md.gz · Last modified: by 127.0.0.1
