Saturday, August 20, 2016

Data Caching & Speed of Communication

An interesting comparison of speed of computer storage:

Teach Yourself Programming in Ten Years by Peter Norvig (AI, Stanford, Google)
On his classes Peter suggests importance of being aware and estimating order of magnitude
of processing time of algorithms, and adjusting programs accordingly, avoid "premature optimizations". For that a higher abstraction language like Python is proffered.

"Approximate timing for various operations on a typical PC:"


execute typical instruction1/1,000,000,000 sec = 1 nanosec
fetch from L1 cache memory0.5 nanosec
branch misprediction5 nanosec
fetch from L2 cache memory7 nanosec
Mutex lock/unlock25 nanosec
fetch from main memory100 nanosec
send 2K bytes over 1Gbps network20,000 nanosec
read 1MB sequentially from memory250,000 nanosec
fetch from new disk location (seek)8,000,000 nanosec
read 1MB sequentially from disk20,000,000 nanosec
send packet US to Europe and back150 milliseconds = 150,000,000 nanosec

Coding Blocks podcast Episode 45 – Caching Overview and Hardware
"In more relatable terms.
  • 1 second for L1 Cache  (actual is 0.5 ns)
  • 5 days for memory
  • 11 days for data center
  • 23 days for SSD
  • 15 months for HD
  • Almost 10 years for internet! (actual is 150 ms)"
Latency Numbers Every Programmer Should Know · GitHub

Visual Animation:
Relative Memory Access speeds (Lesson 3)