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 [February 15, 2026 at 13:24] – yanevskiv | numbers-every-programmer-should-know [May 23, 2026 at 00:12] (current) – Ivan Janevski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | # 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. | ||
| + | |||
| + | ## Content | ||
| + | ``` | ||
| + | Latency Comparison Numbers (~2012) | ||
| + | ---------------------------------- | ||
| + | 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:// | ||
| + | ``` | ||
| + | |||
| + | ## Criticism (Opinion) | ||
| + | While the list is illustrative, | ||
| + | |||
| + | 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/unlock or branch misprediction; | ||
| + | |||
| + | In addition, these numbers evolve as the technology continues to evolve. Because we're talking about latencies, they are subjected to eternal factors (electromagnetic interference, | ||
| + | |||
| + | As mentioned, the list should only be understood as illustrative. | ||
| + | ``` | ||
| + | L1 cache < Branch mispredict < ... < Send packet CA -> Netherlands -> CA | ||
| + | ``` | ||
| + | |||
| + | ## Source | ||
| + | |||
| + | - https:// | ||
