Powered by AppSignal & Oban Pro

Back Of The Envelope Estimation & Powers of Two

fundamentals/boe_powers_of_two.livemd

Back Of The Envelope Estimation & Powers of Two

Data Volume Units Using the (Power of two)

A byte is a sequence of 8 bits. An ASCII character uses one byte of memory (8 bits). Below is a table explaining the data volume unit. Powers of two are often used to measure computer memory. A byte is now considered eight bits (an octet), resulting in the possibility of 256 values (2<sup>8). (The term byte once meant (and in some cases, still means) a collection of bits, typically of 5 to 32 bits, rather than only an 8-bit unit.))

Power Approx. Value Exp Short Name # of Zeros
10 1 Thousand 2<sup>10 1 KB 1_024
20 1 Million 2<sup>20 1 MB 1_048_576
30 1 Billion 2<sup>30 1 GB 1_073_741_824
40 1 Trillion 2<sup>40 1 TB 1_099_511_627_776
50 1 Quadrillion 2<sup>50 1 PB 1_125_899_906_842_624
# 1KB
# 1_024
iex > :math.pow(2, 10) |> round

# 1MB
# 1_048_576
iex > :math.pow(2, 20) |> round

# 1GB
# 1_073_741_824
iex > :math.pow(2, 30) |> round

# 1TB
# 1_099_511_627_776
iex > :math.pow(2, 40) |> round

# 1PB
# 1_125_899_906_842_624
iex > :math.pow(2, 50) |> round

Latency

ms = millisecond, µs = microsecond, ns = nanosecond

1 ms = 10^-3 seconds = 1,000 µs = 1,000,000 ns

1 µs = 10^-6 seconds = 1,000 ns

Interesting Inverse Comparisons

| In Seconds | Name | S Exp | v | Short Name | PwrOf2 | Exp Approx
|————-|————|———-|—|————-|———|—— |1 ms | millisecond| 10^-3 | | ~1 KB |2<sup>10 | ~10^3 |1 µs | microsecond| 10^-6 | | ~1 MB |2<sup>20 | ~10^6 |1 ns | nanosecond | 10^-9 | | ~1 GB |2<sup>30 | ~10^9