Archive
Miscellaneous
Back of the envelope calculations

Back-of-the-envelope Calculations 粗略估算

mylxsw, 2/6/2023 concept

时间单位

时间单位秒(second),毫秒(millisecond),微秒(microsecond),纳秒(nanosecond)换算

  • 1s = 1000ms (秒 -> 毫秒)
  • 1ms = 1000μs (毫秒 -> 微秒)
  • 1μs = 1000ns (微秒 -> 纳秒)

数据单位

数据的表示常用的有两种标准:

  • IEC:国际电工委员会(International Electrotechnical Commission)
  • SI:国际单位制,世界上最普遍采用的标准度量系统

一些常见的数字(2020版)

操作延迟备注
L1 cache reference1ns
Branch mispredict3ns
L2 cache reference4ns
Mutex lock/unlock17ns
Main memory reference100ns
Compress 1KB with Zippy2,000ns ≈ 2μs
Send 2,000 bytes(2KB) over commodity network44ns
SSD random read16,000ns ≈ 16μs
Read 1,000,000 bytes(1MB) sequentially from memory3,000ns ≈ 3μs
Round trip in same datacenter500,000ns ≈ 500μs
Read 1,000,000 bytes(1MB) sequentially from SSD49,000ns ≈ 49μs
Disk seek2,000,000ns ≈ 2ms
Read 1,000,000 bytes(1MB) sequentially from disk825,000ns ≈ 825μs
Packet roundtrip CA to Netherlands150,000,000ns ≈ 150μs

不同年份的数值参考可以看这里:https://colin-scott.github.io/personal_website/research/interactive_latency.html (opens in a new tab)

参考