Modern computers have Random Access Memory (RAM), which is utilized in machine code and data storage. RAM is used alongside the CPU and hard disks in order to store and retrieve information. Utilizing the CPU, RAM, and disks has performance trade-offs. In a modern computer at the time of writing, we have the following generic, rounded timings for some common operations in computers:
Data Storage Type |
Timing |
L1 (Processor Cache) Reference |
1 ns |
L2 (Processor Cache) Reference |
4 ns |
Main Memory Reference |
100 ns |
SSD Random Read |
16 μs |
7200 RPM HDD Disk Seek |
2 ms |
As you'll notice from the table, the different storage types have wildly differing timings for different portions of a modern computer's architecture. New computers have KBs of L1 cache, MBs of L2 cache, GBs of main memory...