Important Computer Science Numbers

*These numbers are as of Dec. 27th, 2024

Storage

Long NameUnitStorage Capacity
Bitbit1 bit
Bytebyte8 bits
KilobitKb1,000 bits
KilobyteKB8,000 bits
MegabitMb1,000,000 bits
MegabyteMB8,000,000 bits
GigabitGb1,000,000,000 bits
GigabyteGB8,000,000,000 bits
TerabitTb1,000,000,000,000 bits
TerabyteTB8,000,000,000,000 bits

Time

Long NameUnitDuration
Seconds1 second
Millisecondms0.001 of a second
Microsecondµs0.000001 of a second
Nanosecondns0.000000001 of a second

For reference, a blink of an eye is on average between 300ms to 400ms, or less than half a second.

Data Access Benchmarks

A 1 GHz CPU has a speed of 1,000,000,000 clock cycles a second. Assuming that a simple instruction takes 1 clock cycle, we can conclude that a simple instruction takes about 1 nanosecond.

The below numbers should be taken with a huge grain of salt. The numbers depend on many factors such as the hardware itself, and the distance from the processor.

CaseLatencyRatio
A simple instruction on a 1GHz CPU1 nanosecond1
Fetch data from L1 cacheAbout 1 nanosecond1
Fetch data from L2 cache4 ns4
Fetch data from L3 cache40 ns40
Fetch data from main memory80 ns80
I/O devices on the memory bus8 µs to 8 ms8,000x to 8,000,000x

Cost

Storage TypeCost for 1 TBRatio
RAM$4,000 – $8,000~2000x
SSD$17056x
HDD$196x
Tape$31x

Sources

http://norvig.com/21-days.html#answers

https://www.intel.com/content/www/us/en/developer/articles/technical/memory-performance-in-a-nutshell.html?